Class: Person
- Inherits:
-
Object
- Object
- Person
- Defined in:
- lib/member.rb
Constant Summary collapse
- ATTRIBUTES =
[:first_name, :last_name, :id, :member_expiration_date, :club, :results, :awards]
Instance Method Summary collapse
-
#initialize(meta = nil) ⇒ Person
constructor
A new instance of Person.
Constructor Details
#initialize(meta = nil) ⇒ Person
Returns a new instance of Person.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/member.rb', line 22 def initialize = nil ## I was trying to avoid initializing an ivar in the do loop ## if it had already been initialized, but couldn't figure out how to do that ## ## I was trying to make this work without having to init the array and hash ## after the do loop #@results = [] #@awards = {} #ATTRIBUTES.find_all{|a| self.a.nil?}.each do |item| <-- does not work # # the 'unless' below does work but doesn't look right @results = [] @awards = {} ATTRIBUTES.each do |item| self.send("#{item}=", ([item] || "")) unless item == :results or item == :awards end if end |