Class: KillerQueenSceneScoring::Match

Inherits:
Object
  • Object
show all
Defined in:
lib/killer_queen_scene_scoring/match.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(challonge_obj, match_values) ⇒ Match

‘challonge_obj` is the Challonge data for this match. `match_values` is the array from the config file that holds how many points are awarded to the teams in that match.



11
12
13
14
15
16
17
# File 'lib/killer_queen_scene_scoring/match.rb', line 11

def initialize(challonge_obj, match_values)
    @team1_id = challonge_obj[:player1_id]
    @team2_id = challonge_obj[:player2_id]

    play_order = challonge_obj[:suggested_play_order]
    @points = match_values[play_order - 1]
end

Instance Attribute Details

#pointsObject (readonly)

Returns the value of attribute points.



6
7
8
# File 'lib/killer_queen_scene_scoring/match.rb', line 6

def points
  @points
end

Instance Method Details

#has_team?(team_id) ⇒ Boolean

Returns whether the team with the Challonge ID ‘team_id` is in this match.

Returns:

  • (Boolean)


20
21
22
# File 'lib/killer_queen_scene_scoring/match.rb', line 20

def has_team?(team_id)
    @team1_id == team_id || @team2_id == team_id
end