Class: RRSchedule::Round

Inherits:
Object
  • Object
show all
Defined in:
lib/rrschedule.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ Round

Returns a new instance of Round.



407
408
409
410
411
412
413
# File 'lib/rrschedule.rb', line 407

def initialize(params={})
  self.round = params[:round]
  self.cycle = params[:cycle]
  self.round_with_cycle = params[:round_with_cycle]
  self.flight = params[:flight]
  self.games = params[:games] || []
end

Instance Attribute Details

#cycleObject

Returns the value of attribute cycle.



405
406
407
# File 'lib/rrschedule.rb', line 405

def cycle
  @cycle
end

#flightObject

Returns the value of attribute flight.



405
406
407
# File 'lib/rrschedule.rb', line 405

def flight
  @flight
end

#gamesObject

Returns the value of attribute games.



405
406
407
# File 'lib/rrschedule.rb', line 405

def games
  @games
end

#roundObject

Returns the value of attribute round.



405
406
407
# File 'lib/rrschedule.rb', line 405

def round
  @round
end

#round_with_cycleObject

Returns the value of attribute round_with_cycle.



405
406
407
# File 'lib/rrschedule.rb', line 405

def round_with_cycle
  @round_with_cycle
end

Instance Method Details

#to_sObject



415
416
417
418
419
420
421
422
423
424
425
426
427
# File 'lib/rrschedule.rb', line 415

def to_s
  str = "FLIGHT #{@flight.to_s} - Round ##{@round.to_s}\n"
  str += "=====================\n"

  self.games.each do |g|
    if [g.team_a,g.team_b].include?(:dummy)
      str+= g.team_a == :dummy ? g.team_b.to_s : g.team_a.to_s + " has a BYE\n"
    else
      str += g.team_a.to_s + " Vs " + g.team_b.to_s + "\n"
    end
  end
  str += "\n"
end