class Rubygoal::MatchData::Team

Attributes

positions[R]
result[R]
score[R]

Public Class Methods

new(score, result, positions = nil) click to toggle source
# File lib/rubygoal/match_data.rb, line 74
def initialize(score, result, positions = nil)
  @score  = score
  @result = result
  @positions = positions

  convert_positions_to_percentages
end

Public Instance Methods

draw?() click to toggle source
# File lib/rubygoal/match_data.rb, line 82
def draw?
  result == :draw
end
losing?() click to toggle source
# File lib/rubygoal/match_data.rb, line 90
def losing?
  result == :lose
end
winning?() click to toggle source
# File lib/rubygoal/match_data.rb, line 86
def winning?
  result == :win
end

Private Instance Methods

convert_positions_to_percentages() click to toggle source
# File lib/rubygoal/match_data.rb, line 96
def convert_positions_to_percentages
  @positions = positions.each_with_object({}) do |(name, pos), hash|
    hash[name] = Field.position_to_percentages(pos)
  end
end