class ASF::MemApps

Public Class Methods

emeritus() click to toggle source

names of emeritus files

# File lib/whimsy/asf/memapps.rb, line 32
def self.emeritus
  refresh
  apps = @@files.select {|f| f =~ /_emeritus\.\w+$/}.map do |file|
    file.sub(/_emeritus\.\w+$/, '')
  end
  apps
end
files() click to toggle source

All files, including emeritus

# File lib/whimsy/asf/memapps.rb, line 85
def self.files
  refresh
  @@files
end
find(person) click to toggle source

find the memapp for a person; return an array:

  • array of files that matched (possibly empty), array of stems that were tried
# File lib/whimsy/asf/memapps.rb, line 65
def self.find(person)
  found=[] # matches we found
  names=[] # names we tried
  [
    (person.icla.legal_name rescue nil),
    (person.icla.name rescue nil),
    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
find1st(person) click to toggle source

find the name of the memapp for a person or nil

# File lib/whimsy/asf/memapps.rb, line 59
def self.find1st(person)
  self.find(person)[0].first
end
names() click to toggle source

list the names of the files (excluding any ones which record emeritus)

# File lib/whimsy/asf/memapps.rb, line 26
def self.names
  refresh
  @@files.reject{|f| f =~ /_emeritus\.\w+$/}
end
sanitize(name) click to toggle source
# File lib/whimsy/asf/memapps.rb, line 40
def self.sanitize(name)
  # Don't transform punctation into '-'
  ASF::Person.asciize(name.strip.downcase.gsub(/[.,()"]/,''))
end
stems() click to toggle source

list the stems of the files (excluding any ones which record emeritus)

# File lib/whimsy/asf/memapps.rb, line 17
def self.stems
  refresh
  apps = @@files.reject{|f| f =~ /_emeritus\.\w+$/}.map do |file|
    file.sub(/\.\w+$/, '')
  end
  apps
end