Class: Challonge::Match

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

Overview

the only attributes that will save are: scores_csv, winner_id

Instance Method Summary collapse

Methods inherited from API

key, key=, username, username=

Instance Method Details

#createObject

not implemented by API



27
# File 'lib/challonge/match.rb', line 27

def create; end

#destroyObject

not implemented by API



30
# File 'lib/challonge/match.rb', line 30

def destroy; end

#player1Object



14
15
16
# File 'lib/challonge/match.rb', line 14

def player1
  _find_player(:player1_id)
end

#player2Object



18
19
20
# File 'lib/challonge/match.rb', line 18

def player2
  _find_player(:player2_id)
end

#player_winner?(participant) ⇒ Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/challonge/match.rb', line 22

def player_winner? (participant)
  (participant.id != self.winner_id)
end

#tournamentObject



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

def tournament
  Challonge::Tournament.find(self.prefix_options[:tournament_id])
end

#tournament=(tournament) ⇒ Object



10
11
12
# File 'lib/challonge/match.rb', line 10

def tournament=(tournament)
  self.prefix_options[:tournament_id] = tournament.id
end