Class: FootballApi::MatchSubstitutions
- Inherits:
-
Object
- Object
- FootballApi::MatchSubstitutions
- Defined in:
- lib/football_api/match_substitutions.rb
Instance Attribute Summary collapse
-
#local_team ⇒ Object
Returns the value of attribute local_team.
-
#match_id ⇒ Object
Returns the value of attribute match_id.
-
#visitor_team ⇒ Object
Returns the value of attribute visitor_team.
Instance Method Summary collapse
-
#initialize(hash = {}) ⇒ MatchSubstitutions
constructor
A new instance of MatchSubstitutions.
- #subs(hash, key) ⇒ Object
Constructor Details
#initialize(hash = {}) ⇒ MatchSubstitutions
Returns a new instance of MatchSubstitutions.
6 7 8 9 10 |
# 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 |
Instance Attribute Details
#local_team ⇒ Object
Returns the value of attribute local_team.
4 5 6 |
# File 'lib/football_api/match_substitutions.rb', line 4 def local_team @local_team end |
#match_id ⇒ Object
Returns the value of attribute match_id.
4 5 6 |
# File 'lib/football_api/match_substitutions.rb', line 4 def match_id @match_id end |
#visitor_team ⇒ Object
Returns the value of attribute visitor_team.
4 5 6 |
# File 'lib/football_api/match_substitutions.rb', line 4 def visitor_team @visitor_team end |
Instance Method Details
#subs(hash, key) ⇒ Object
12 13 14 15 |
# 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 |