class ASF::MemApps
Constants
- STEM
Public Class Methods
Source
# File lib/whimsy/asf/memapps.rb, line 84 def self.files refresh @@files end
All files
Source
# File lib/whimsy/asf/memapps.rb, line 63 def self.find(person) found = [] # matches we found names = [] # names we tried [ (person.icla.legal_name rescue nil), (person.icla.name rescue nil), person.id, # allow match on avalid person.member_name # this is slow ].uniq.each do |name| next unless name memapp = self.sanitize(name) # this may generate dupes, so we use uniq below names << memapp file = self.search(memapp) if file found << file end end return [found, names.uniq] end
find the memapp for a person; return an array:
- array of files that matched (possibly empty), array of stems that were tried
Source
# File lib/whimsy/asf/memapps.rb, line 57 def self.find1st(person) self.find(person)[0].first end
find the name of the memapp for a person or nil
Source
# File lib/whimsy/asf/memapps.rb, line 30 def self.names refresh @@files end
list the names of the files (excluding any ones which record emeritus)
Source
# File lib/whimsy/asf/memapps.rb, line 91 def self.refresh cache_dir = ASF::DocumentUtils.check_cache(STEM).first # trimSlash, getEpoch @@tag, list = ASF::SVN.getlisting(STEM, @@tag, true, false, cache_dir) if list @@files = list end end
Source
# File lib/whimsy/asf/memapps.rb, line 35 def self.sanitize(name) # Don't transform punctuation into '-' ASF::Person.asciize(name.strip.downcase.gsub(/[.,()"]/, '')) end
Source
# File lib/whimsy/asf/memapps.rb, line 43 def self.search(filename) names = self.names() if names.include?(filename) return filename end names.each { |name| if name.start_with?("#{filename}.") return name end } nil end
search for file name @return filename if it exists, or return full name if filename matches the stem of a file
Source
# File lib/whimsy/asf/memapps.rb, line 22 def self.stems refresh @@files.map do |file| file.sub(/\.\w+$/, '') end end
list the stems of the files
Source
# File lib/whimsy/asf/memapps.rb, line 17 def self.update_cache(env) ASF::DocumentUtils.update_cache(STEM, env) end