Method: Infostrada::Player#initialize
- Defined in:
- lib/infostrada/player.rb
#initialize(hash) ⇒ Player
Returns a new instance of Player.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/infostrada/player.rb', line 18 def initialize(hash) @person_id = hash['n_PersonID'] @name = hash['c_Person'] @short_name = hash['c_PersonShort'] @birthdate = Formatter.format_date(hash['d_BirthDate']) # Function is one string like "Goalkeeper", "Defender", "Midfielder", "Forward", "Coach"... # Infostrada doesn't document the function strings so you should rely on function_type @function = hash['c_Function'] @function_type = hash['n_FunctionType'] @shirt_number = hash['n_ShirtNr'] @contract_starts_at = Formatter.format_date(hash['d_ContractStartDate']) @contract_ends_at = Formatter.format_date(hash['d_ContractEndDate']) # Season statistics set_season_stats(hash) @nation = Nation.new(hash, 'person') self end |