class DotkaM::Match
Public Instance Methods
duration()
click to toggle source
# File lib/dotka/match.rb, line 35 def duration @raw["duration"].to_i end
game_mode()
click to toggle source
# File lib/dotka/match.rb, line 47 def game_mode GameMode.new Storage.new.get("game_modes", {"id" => @raw["game_mode"]}) end
id()
click to toggle source
# File lib/dotka/match.rb, line 13 def id @raw["match_id"].to_i end
load_info(dotka)
click to toggle source
API limitation workaround.
# File lib/dotka/match.rb, line 56 def load_info dotka raise "Expected an instance of Dotka." unless dotka.is_a? Dotka @raw = dotka.match(self.id).raw end
lobby()
click to toggle source
# File lib/dotka/match.rb, line 43 def lobby Lobby.new Storage.new.get("lobbies", {"id" => @raw["lobby_type"]}) end
player(account_id)
click to toggle source
# File lib/dotka/match.rb, line 27 def player account_id players.select { |player| player.account_id == account_id.to_i }.first end
players()
click to toggle source
# File lib/dotka/match.rb, line 17 def players players = Array.new @raw["players"].each { |player| players.push Player.new(player) } players end
region()
click to toggle source
# File lib/dotka/match.rb, line 51 def region Region.new Storage.new.get("regions", {"id" => @raw["cluster"]}) end
start_time()
click to toggle source
# File lib/dotka/match.rb, line 39 def start_time @raw["start_time"].to_i end
winner()
click to toggle source
# File lib/dotka/match.rb, line 31 def winner (!! @raw["radiant_win"]) ? "radiant" : "dire" end