class Rubygoal::MatchData

Attributes

ball[R]
me[R]
other[R]
time[R]

Public Class Methods

new(my_score, other_score, ball_position, my_positions, other_positions, time) click to toggle source
# File lib/rubygoal/match_data.rb, line 105
def initialize(my_score, other_score, ball_position, my_positions, other_positions, time)
  @me = MatchData::Team.new(
    my_score,
    result(my_score, other_score),
    my_positions
  )
  @other = MatchData::Team.new(
    other_score,
    result(other_score, my_score),
    other_positions
  )
  @time = time
  @ball = ball_position
end

Public Instance Methods

result(my_score, other_score) click to toggle source
# File lib/rubygoal/match_data.rb, line 120
def result(my_score, other_score)
  if my_score > other_score
    :win
  elsif my_score < other_score
    :lose
  else
    :draw
  end
end