lib/whimsy/asf/nominees.rb in whimsy-asf-0.0.75 vs lib/whimsy/asf/nominees.rb in whimsy-asf-0.0.76
- old
+ new
@@ -1,11 +1,16 @@
+require 'weakref'
+
module ASF
class Person < Base
def self.member_nominees
- return @member_nominees if @member_nominees
+ begin
+ return Hash[@member_nominees.to_a] if @member_nominees
+ rescue NoMethodError, WeakRef::RefError
+ end
meetings = ASF::SVN['private/foundation/Meetings']
nominations = Dir["#{meetings}/*/nominated-members.txt"].sort.last.untaint
nominations = File.read(nominations).split(/^\s*---+\s*/)
@@ -20,13 +25,14 @@
next unless id
nominees[find(id)] = nomination
end
- @member_nominees = nominees
+ @member_nominees = WeakRef.new(nominees)
+ nominees
end
def member_nomination
- Person.member_nominees[self]
+ @member_nomination ||= Person.member_nominees[self]
end
end
end