Class: ASF::Member
- Inherits:
-
Object
- Object
- ASF::Member
- Includes:
- Enumerable
- Defined in:
- lib/whimsy/asf/member.rb
Instance Attribute Summary collapse
-
#full ⇒ Object
Returns the value of attribute full.
Class Method Summary collapse
- .each(&block) ⇒ Object
- .emails(text) ⇒ Object
- .find(id) ⇒ Object
- .find_by_email(value) ⇒ Object
- .find_text_by_id(value) ⇒ Object
- .list ⇒ Object
- .status ⇒ Object
- .svn_change ⇒ Object
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(full = nil) ⇒ Member
constructor
A new instance of Member.
Constructor Details
Instance Attribute Details
#full ⇒ Object
Returns the value of attribute full.
4 5 6 |
# File 'lib/whimsy/asf/member.rb', line 4 def full @full end |
Class Method Details
.each(&block) ⇒ Object
13 14 15 |
# File 'lib/whimsy/asf/member.rb', line 13 def self.each(&block) new.each(&block) end |
.emails(text) ⇒ Object
68 69 70 71 |
# File 'lib/whimsy/asf/member.rb', line 68 def self.emails(text) emails = text.to_s.scan(/Email: (.*(?:\n\s+\S+@.*)*)/).flatten. join(' ').split(/\s+/).grep(/@/) end |
.find(id) ⇒ Object
63 64 65 66 |
# File 'lib/whimsy/asf/member.rb', line 63 def self.find(id) each {|availid| return true if availid == id} return false end |
.find_by_email(value) ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/whimsy/asf/member.rb', line 25 def self.find_by_email(value) value = value.downcase each do |id, text| emails(text).each do |email| return Person[id] if email.downcase == value end end nil end |
.find_text_by_id(value) ⇒ Object
6 7 8 9 10 11 |
# File 'lib/whimsy/asf/member.rb', line 6 def self.find_text_by_id(value) new.each do |id, text| return text if id==value end nil end |
.list ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/whimsy/asf/member.rb', line 17 def self.list result = Hash[self.new(true).map {|name, text| [name, {text: text}]}] self.status.each do |name, value| result[name]['status'] = value end result end |
.status ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/whimsy/asf/member.rb', line 35 def self.status return @status if @status status = {} foundation = ASF::SVN['private/foundation'] return status unless foundation sections = File.read("#{foundation}/members.txt").split(/(.*\n===+)/) sections.shift(3) sections.each_slice(2) do |header, text| header.sub!(/s\n=+/,'') text.scan(/Avail ID: (.*)/).flatten.each {|id| status[id] = header} end @status = status end |
Instance Method Details
#each ⇒ Object
53 54 55 56 57 58 59 60 61 |
# File 'lib/whimsy/asf/member.rb', line 53 def each foundation = ASF::SVN['private/foundation'] File.read("#{foundation}/members.txt").split(/^ \*\) /).each do |section| id = section[/Avail ID: (.*)/,1] section = '' unless @full yield id, section.sub(/\n.*\n===+\s*?\n(.*\n)+.*/,'').strip if id end nil end |