Class: FplGsheet::FixtureTeam
- Inherits:
-
Object
- Object
- FplGsheet::FixtureTeam
- Defined in:
- lib/fpl_gsheet/team.rb
Instance Method Summary collapse
-
#initialize(fixture, team_id) ⇒ FixtureTeam
constructor
A new instance of FixtureTeam.
- #opp_score ⇒ Object
- #opponent ⇒ Object
- #own_score ⇒ Object
- #result ⇒ Object
Constructor Details
#initialize(fixture, team_id) ⇒ FixtureTeam
Returns a new instance of FixtureTeam.
21 22 23 24 25 26 |
# File 'lib/fpl_gsheet/team.rb', line 21 def initialize(fixture,team_id) @fixture=fixture @venue = fixture.data['team_h']==team_id ? 'H' : 'A' @h_score = fixture.data['team_h_score'] @a_score = fixture.data['team_a_score'] end |
Instance Method Details
#opp_score ⇒ Object
39 40 41 |
# File 'lib/fpl_gsheet/team.rb', line 39 def opp_score @venue=='H' ? @a_score : @h_score end |
#opponent ⇒ Object
43 44 45 46 |
# File 'lib/fpl_gsheet/team.rb', line 43 def opponent id = @venue=='H' ? @fixture['team_a'] : @fixture['team_h'] # How to get from this id to the Team object it represents? end |
#own_score ⇒ Object
35 36 37 |
# File 'lib/fpl_gsheet/team.rb', line 35 def own_score @venue=='H' ? @h_score : @a_score end |
#result ⇒ Object
28 29 30 31 32 33 |
# File 'lib/fpl_gsheet/team.rb', line 28 def result return '-' if @h_score=='null' return 'D' if @h_score==@a_score winner = @h_score==@a_score ? 'H' : 'A' return @venue==winner ? 'W' : 'L' end |