class FtcEvent::Elimination

Attributes

event[R]
match[R]

Public Class Methods

new(event, match) click to toggle source
# File lib/ftc_event/elimination.rb, line 8
def initialize(event, match)
  @event = event
  @match = match
end

Public Instance Methods

alliances() click to toggle source
# File lib/ftc_event/elimination.rb, line 51
def alliances
  positions.each_with_object({}) do |position, h|
    h[position] = Alliance.new(event, info[position])
  end
end
each_team(alliance) { |team| ... } click to toggle source
# File lib/ftc_event/elimination.rb, line 57
def each_team(alliance)
  return enum_for(:each_team, alliance) unless block_given?

  alliances[alliance].each_team do |team|
    yield team
  end

  nil
end
long_alliance_description(color) click to toggle source
# File lib/ftc_event/elimination.rb, line 71
def long_alliance_description(color)
  alliances[color].long_description
end
long_name() click to toggle source
# File lib/ftc_event/elimination.rb, line 34
def long_name
  case match
  when 1, 3, 5
    'Semifinal 1 Match %i' % [(match + 1) / 2]
  when 2, 4, 6
    'Semifinal 2 Match %i' % [(match + 0) / 2]
  when 7
    'Final Match 1'
  when 9
    'Final Match 2'
  end
end
positions() click to toggle source
# File lib/ftc_event/elimination.rb, line 47
def positions
  FtcEvent::ALLIANCES
end
short_alliance_description(color) click to toggle source
# File lib/ftc_event/elimination.rb, line 67
def short_alliance_description(color)
  alliances[color].short_description
end
short_identifier() click to toggle source
# File lib/ftc_event/elimination.rb, line 30
def short_identifier
  short_name.gsub(/-/, '')
end
short_name() click to toggle source
# File lib/ftc_event/elimination.rb, line 17
def short_name
  case match
  when 1, 3, 5
    'SF1-%i' % [(match + 1) / 2]
  when 2, 4, 6
    'SF2-%i' % [(match + 0) / 2]
  when 7
    'F-1'
  when 9
    'F-2'
  end
end
table_prefix() click to toggle source
# File lib/ftc_event/elimination.rb, line 13
def table_prefix
  'elims'
end