Sha256: a6d6efde63d974d3b9e03b5c9ee3ff5181a90e5341c6988c745e73aa78b57cd0
Contents?: true
Size: 1.88 KB
Versions: 2
Compression:
Stored size: 1.88 KB
Contents
# Front sections: # * Call to Order # * Roll Call class ASF::Board::Agenda @@people_cache = {} parse do pattern = / ^\n\x20(?<section>[12]\.) \s(?<title>.*?)\n\n+ (?<text>.*?) (?=\n\s[23]\.) /mx scan @file, pattern do |attr| if attr['title'] == 'Roll Call' attr['people'] = {} list = nil # attempt to identify the people mentioned in the Roll Call people = attr['text'].scan(/ {8}(\w.*)/).flatten.each do |sname| name = sname # first try the cache person = @@people_cache[name] # next try a simple name look up if not person search = ASF::Person.list("cn=#{name}") person = search.first if search.length == 1 end # finally try harder to match the name if not person sname = sname.strip.downcase.split(/\s+/) if not list ASF::Person.preload('cn') list = ASF::Person.list end search = [] list.select do |person| next if person == 'none' pname = person.public_name.downcase.split(/\s+/) if sname.all? {|t1| pname.any? {|t2| t2.start_with? t1}} search << person elsif pname.all? {|t1| sname.any? {|t2| t2.start_with? t1}} search << person end end person = search.first if search.length == 1 end # save results in both the cache and the attributes if person @@people_cache[name] = person attr['people'][person.id] = { name: name, member: person.asf_member? } end end elsif attr['title'] == 'Call to order' attr['timestamp'] = timestamp(attr['text'][/\d+:\d+([ap]m)?/]) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
whimsy-asf-0.0.2 | lib/whimsy/asf/agenda/front.rb |
whimsy-asf-0.0.1 | lib/whimsy/asf/agenda/front.rb |