class ASF::ICLAFiles
Common class for access to documents/iclas/ directory Only intended for use by secretary team
Constants
- STEM
Public Class Methods
Source
# File lib/whimsy/asf/documents.rb, line 137 def self.Dir?(name) listnames.include? name + '/' end
is the name a directory?
Source
# File lib/whimsy/asf/documents.rb, line 156 def self.listnames # iclas.txt no longer updated by cronjob cache_dir = ASF::DocumentUtils.check_cache(STEM).first @@tag, list = ASF::SVN.getlisting(STEM, @@tag, false, false, cache_dir) if list # we have a new list # update the list cache @@list = list # clear the hash caches @@h_claRef = nil @@h_stem = nil end @@list end
This returns the list of names in the top-level directory directory names are terminated by ‘/’
Source
# File lib/whimsy/asf/documents.rb, line 143 def self.matchStem(stem) unless @@h_stem h_stem = Hash.new {|h, k| h[k] = []} listnames.map do |l| h_stem[l.split('.')[0]] << l unless l.end_with?('/') end @@h_stem = h_stem end @@h_stem[stem] end
return a list of names matching stem.* Does not return directories
Source
# File lib/whimsy/asf/documents.rb, line 118 def self.match_claRef(claRef) unless @@h_claRef h_claRef = {} listnames.map do |l| # Match either full name (e.g. directory) or stem (e.g. name.pdf) if l.end_with? '/' h_claRef[l.chomp('/')] = l.chomp('/') elsif l.include?('.') h_claRef[l.split('.')[0]] = l else h_claRef[l] = l end end @@h_claRef = h_claRef end @@h_claRef[claRef] end
search icla files to find match with claRef matches if the input matches the full name of a file or directory or it matches with an extension Returns the basename or nil if no match
Source
# File lib/whimsy/asf/documents.rb, line 110 def self.update_cache(env) ASF::DocumentUtils.update_cache(STEM, env) end