class FootballApi::MatchSubstitutions

Attributes

local_team[RW]
match_id[RW]
visitor_team[RW]

Public Class Methods

new(hash = {}) click to toggle source
# File lib/football_api/match_substitutions.rb, line 6
def initialize(hash = {})
  @match_id     = hash[:match_id]
  @local_team   = subs(hash, :localteam)
  @visitor_team = subs(hash, :visitorteam)
end

Public Instance Methods

subs(hash, key) click to toggle source
# File lib/football_api/match_substitutions.rb, line 12
def subs(hash, key)
  return [] unless hash[key]
  Array(hash[key][:substitution]).map { |s| Substitution.new(s) }
end