Class: Sportradar::Api::Football::StatsShim
- Inherits:
-
Object
- Object
- Sportradar::Api::Football::StatsShim
- Defined in:
- lib/sportradar/api/football/stats_shim.rb
Instance Attribute Summary collapse
-
#game ⇒ Object
readonly
Returns the value of attribute game.
Instance Method Summary collapse
- #dig(player_id, category, stat) ⇒ Object
-
#initialize(game) ⇒ StatsShim
constructor
A new instance of StatsShim.
Constructor Details
#initialize(game) ⇒ StatsShim
Returns a new instance of StatsShim.
7 8 9 |
# File 'lib/sportradar/api/football/stats_shim.rb', line 7 def initialize(game) @game = game end |
Instance Attribute Details
#game ⇒ Object (readonly)
Returns the value of attribute game.
5 6 7 |
# File 'lib/sportradar/api/football/stats_shim.rb', line 5 def game @game end |
Instance Method Details
#dig(player_id, category, stat) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/sportradar/api/football/stats_shim.rb', line 11 def dig(player_id, category, stat) game.team_stats.each_value do |stats| player = stats.public_send(category).for_player(player_id) if player return player.send(stat) end end nil end |