Class: FootballApi::Bench
- Inherits:
-
Object
- Object
- FootballApi::Bench
- Defined in:
- lib/football_api/match_bench.rb
Instance Attribute Summary collapse
-
#players ⇒ Object
Returns the value of attribute players.
-
#team ⇒ Object
Returns the value of attribute team.
Instance Method Summary collapse
-
#initialize(opts = {}, key) ⇒ Bench
constructor
A new instance of Bench.
Constructor Details
#initialize(opts = {}, key) ⇒ Bench
Returns a new instance of Bench.
17 18 19 20 21 22 23 24 25 |
# File 'lib/football_api/match_bench.rb', line 17 def initialize(opts = {}, key) # XXX - Use case for more than one player, might be different # Api returns single object without number index on single occurrence. opts = opts[key] return unless opts.present? @team = key @players = Array(opts[:player]).map { |v| Player.new(v) } end |
Instance Attribute Details
#players ⇒ Object
Returns the value of attribute players.
15 16 17 |
# File 'lib/football_api/match_bench.rb', line 15 def players @players end |
#team ⇒ Object
Returns the value of attribute team.
15 16 17 |
# File 'lib/football_api/match_bench.rb', line 15 def team @team end |