Class: Person

Inherits:
Object
  • Object
show all
Defined in:
lib/member.rb

Constant Summary collapse

ATTRIBUTES =
[:first_name, :last_name, :id, :member_expiration_date, :club, :results, :awards]

Instance Method Summary collapse

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 meta = 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}=", (meta[item] || "")) unless item == :results or item == :awards
  end if meta

end