Class: NFL::LiveUpdate::GameCenter::Team
- Inherits:
-
Object
- Object
- NFL::LiveUpdate::GameCenter::Team
- Defined in:
- lib/nfl/live_update/game_center/team.rb
Instance Attribute Summary collapse
-
#abbr ⇒ Object
Returns the value of attribute abbr.
-
#players ⇒ Object
Returns the value of attribute players.
-
#score ⇒ Object
Returns the value of attribute score.
-
#stats ⇒ Object
Returns the value of attribute stats.
-
#time_outs ⇒ Object
Returns the value of attribute time_outs.
Instance Method Summary collapse
-
#initialize(json) ⇒ Team
constructor
A new instance of Team.
Constructor Details
#initialize(json) ⇒ Team
Returns a new instance of Team.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/nfl/live_update/game_center/team.rb', line 8 def initialize(json) @abbr = json["abbr"] @time_outs = json["to"] @players = json["players"] @score = TeamScore.new(json["score"]) @stats = json["stats"] @stats.each do |k,v| self.class.class_eval do define_method("#{k}_stats") do @stats[k] end end @stats[k] = if k == "team" TeamStat.new(@stats[k]) else @stats[k].map do |k2,v2| PlayerStat.new(k2, v2) end end end end |
Instance Attribute Details
#abbr ⇒ Object
Returns the value of attribute abbr.
6 7 8 |
# File 'lib/nfl/live_update/game_center/team.rb', line 6 def abbr @abbr end |
#players ⇒ Object
Returns the value of attribute players.
6 7 8 |
# File 'lib/nfl/live_update/game_center/team.rb', line 6 def players @players end |
#score ⇒ Object
Returns the value of attribute score.
6 7 8 |
# File 'lib/nfl/live_update/game_center/team.rb', line 6 def score @score end |
#stats ⇒ Object
Returns the value of attribute stats.
6 7 8 |
# File 'lib/nfl/live_update/game_center/team.rb', line 6 def stats @stats end |
#time_outs ⇒ Object
Returns the value of attribute time_outs.
6 7 8 |
# File 'lib/nfl/live_update/game_center/team.rb', line 6 def time_outs @time_outs end |