Class: FootballApi::MatchTeam
- Inherits:
-
Object
- Object
- FootballApi::MatchTeam
- Defined in:
- lib/football_api/match_team.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#players ⇒ Object
Returns the value of attribute players.
Instance Method Summary collapse
-
#initialize(hash = {}, key) ⇒ MatchTeam
constructor
A new instance of MatchTeam.
- #parse_players(hash = {}, key) ⇒ Object
Constructor Details
#initialize(hash = {}, key) ⇒ MatchTeam
Returns a new instance of MatchTeam.
6 7 8 9 |
# File 'lib/football_api/match_team.rb', line 6 def initialize(hash = {}, key) @id = hash[:comm_match_id] @players = parse_players(hash, key) end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
4 5 6 |
# File 'lib/football_api/match_team.rb', line 4 def id @id end |
#players ⇒ Object
Returns the value of attribute players.
4 5 6 |
# File 'lib/football_api/match_team.rb', line 4 def players @players end |
Instance Method Details
#parse_players(hash = {}, key) ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/football_api/match_team.rb', line 11 def parse_players(hash = {}, key) players = [] Array(hash[:comm_match_teams][key][:player]).each do |player| players << FootballApi::Player.new(player) end Array(hash[:comm_match_subs][key][:player]).each do |player| players << FootballApi::Player.new(player) end players end |