Class: FtcEvent::Qualification
- Inherits:
-
Match
- Object
- Match
- FtcEvent::Qualification
show all
- Defined in:
- lib/ftc_event/qualification.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from Match
#data, #game_specific, #info, #long_alliances_description, #long_description, #one_row_from_table, #other_alliance, #penalties_by, #points_for, #posted, #result, #result_for, #results, #scheduled, #score_for, #short_alliances_description, #short_description, #started, #win_for, #winner
Constructor Details
#initialize(event, match) ⇒ Qualification
Returns a new instance of Qualification.
8
9
10
11
|
# File 'lib/ftc_event/qualification.rb', line 8
def initialize(event, match)
@event = event
@match = match
end
|
Instance Attribute Details
#event ⇒ Object
Returns the value of attribute event.
5
6
7
|
# File 'lib/ftc_event/qualification.rb', line 5
def event
@event
end
|
#match ⇒ Object
Returns the value of attribute match.
6
7
8
|
# File 'lib/ftc_event/qualification.rb', line 6
def match
@match
end
|
Instance Method Details
#each_team(alliance) ⇒ Object
39
40
41
42
43
44
45
46
47
|
# File 'lib/ftc_event/qualification.rb', line 39
def each_team(alliance)
return enum_for(:each_team, alliance) unless block_given?
teams.each do |position, team|
yield team if position.start_with?(alliance)
end
nil
end
|
#long_alliance_description(color) ⇒ Object
56
57
58
59
60
61
|
# File 'lib/ftc_event/qualification.rb', line 56
def long_alliance_description(color)
'%s and %s' % [
teams["#{color}1"].description,
teams["#{color}2"].description,
]
end
|
#long_name ⇒ Object
25
26
27
|
# File 'lib/ftc_event/qualification.rb', line 25
def long_name
'Qualification Match %i' % [match]
end
|
#positions ⇒ Object
29
30
31
|
# File 'lib/ftc_event/qualification.rb', line 29
def positions
FtcEvent::ALLIANCES.product([1, 2]).map(&:join)
end
|
#short_alliance_description(color) ⇒ Object
49
50
51
52
53
54
|
# File 'lib/ftc_event/qualification.rb', line 49
def short_alliance_description(color)
'%i & %i' % [
teams["#{color}1"]&.number || 0,
teams["#{color}2"]&.number || 0,
]
end
|
#short_identifier ⇒ Object
21
22
23
|
# File 'lib/ftc_event/qualification.rb', line 21
def short_identifier
'Q%02i' % [match]
end
|
#short_name ⇒ Object
17
18
19
|
# File 'lib/ftc_event/qualification.rb', line 17
def short_name
'Q-%i' % [match]
end
|
#table_prefix ⇒ Object
13
14
15
|
# File 'lib/ftc_event/qualification.rb', line 13
def table_prefix
'quals'
end
|
#teams ⇒ Object
33
34
35
36
37
|
# File 'lib/ftc_event/qualification.rb', line 33
def teams
positions.each_with_object({}) do |position, h|
h[position] = Team.new(event, info[position])
end
end
|