Class: FtcEvent::Elimination
- Inherits:
-
Match
- Object
- Match
- FtcEvent::Elimination
show all
- Defined in:
- lib/ftc_event/elimination.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, #teams, #win_for, #winner
Constructor Details
#initialize(event, match) ⇒ Elimination
Returns a new instance of Elimination.
8
9
10
11
|
# File 'lib/ftc_event/elimination.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/elimination.rb', line 5
def event
@event
end
|
#match ⇒ Object
Returns the value of attribute match.
6
7
8
|
# File 'lib/ftc_event/elimination.rb', line 6
def match
@match
end
|
Instance Method Details
#alliances ⇒ Object
51
52
53
54
55
|
# 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) ⇒ Object
57
58
59
60
61
62
63
64
65
|
# 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) ⇒ Object
71
72
73
|
# File 'lib/ftc_event/elimination.rb', line 71
def long_alliance_description(color)
alliances[color].long_description
end
|
#long_name ⇒ Object
34
35
36
37
38
39
40
41
42
43
44
45
|
# 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 ⇒ Object
47
48
49
|
# File 'lib/ftc_event/elimination.rb', line 47
def positions
FtcEvent::ALLIANCES
end
|
#short_alliance_description(color) ⇒ Object
67
68
69
|
# File 'lib/ftc_event/elimination.rb', line 67
def short_alliance_description(color)
alliances[color].short_description
end
|
#short_identifier ⇒ Object
30
31
32
|
# File 'lib/ftc_event/elimination.rb', line 30
def short_identifier
short_name.gsub(/-/, '')
end
|
#short_name ⇒ Object
17
18
19
20
21
22
23
24
25
26
27
28
|
# 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 ⇒ Object
13
14
15
|
# File 'lib/ftc_event/elimination.rb', line 13
def table_prefix
'elims'
end
|