Class: FootballApi::Bench

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#playersObject

Returns the value of attribute players.



15
16
17
# File 'lib/football_api/match_bench.rb', line 15

def players
  @players
end

#teamObject

Returns the value of attribute team.



15
16
17
# File 'lib/football_api/match_bench.rb', line 15

def team
  @team
end