Sha256: c2ac8bb302bac44436b9960cae4d46ff47d9fa35f7a28a75564588be934e9370
Contents?: true
Size: 1001 Bytes
Versions: 4
Compression:
Stored size: 1001 Bytes
Contents
module Smite class FullMatch < Smite::Object attr_accessor :queue, :match def initialize(data) data = { 'competitors' => data.map { |k, v| Smite::Competitor.new(k) } } super @queue = competitors[0].queue @match = competitors[0].match end def teams { team1: team1, team2: team2 } end def parties competitors.group_by(&:party_id) end def players competitors end def size competitors.count end def ranked? queue =~ /Ranked/ end def size_str "#{size/2} v #{size/2}" end def team1 competitors[0...size/2] end def team2 competitors[size/2..-1] end def winning_team return @winner unless @winner.nil? @winner = teams.find do |team, competitors| competitors.all? { |competitor| competitor.winner? } end @winner = @winner[0] end def inspect "#<Smite::FullMatch #{match} #{queue}>" end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
smite_ruby-1.5.1 | lib/smite/full_match.rb |
smite_ruby-1.5.0 | lib/smite/full_match.rb |
smite_ruby-1.4.9 | lib/smite/full_match.rb |
smite_ruby-1.4.6 | lib/smite/full_match.rb |