Class: SciolyFF::Interpreter::Tournament

Inherits:
Model
  • Object
show all
Defined in:
lib/sciolyff/interpreter/tournament.rb

Overview

Models a Science Olympiad tournament

Instance Attribute Summary collapse

Attributes inherited from Model

#tournament

Instance Method Summary collapse

Methods inherited from Model

#inspect

Constructor Details

#initialize(rep) ⇒ Tournament

Returns a new instance of Tournament.



8
9
10
# File 'lib/sciolyff/interpreter/tournament.rb', line 8

def initialize(rep)
  @rep = rep[:Tournament]
end

Instance Attribute Details

#eventsObject (readonly)

Returns the value of attribute events.



19
20
21
# File 'lib/sciolyff/interpreter/tournament.rb', line 19

def events
  @events
end

#penaltiesObject (readonly)

Returns the value of attribute penalties.



19
20
21
# File 'lib/sciolyff/interpreter/tournament.rb', line 19

def penalties
  @penalties
end

#placingsObject (readonly)

Returns the value of attribute placings.



19
20
21
# File 'lib/sciolyff/interpreter/tournament.rb', line 19

def placings
  @placings
end

#teamsObject (readonly)

Returns the value of attribute teams.



19
20
21
# File 'lib/sciolyff/interpreter/tournament.rb', line 19

def teams
  @teams
end

Instance Method Details

#custom_maximum_place?Boolean

Returns:

  • (Boolean)


71
72
73
# File 'lib/sciolyff/interpreter/tournament.rb', line 71

def custom_maximum_place?
  maximum_place != @teams.count { |t| !t.exhibition? }
end

#dateObject



51
52
53
# File 'lib/sciolyff/interpreter/tournament.rb', line 51

def date
  @rep[:date]
end

#divisionObject



43
44
45
# File 'lib/sciolyff/interpreter/tournament.rb', line 43

def division
  @rep[:division]
end

#exempt_placingsObject



67
68
69
# File 'lib/sciolyff/interpreter/tournament.rb', line 67

def exempt_placings
  exempt_placings? ? @rep[:'exempt placings'] : 0
end

#exempt_placings?Boolean

Returns:

  • (Boolean)


63
64
65
# File 'lib/sciolyff/interpreter/tournament.rb', line 63

def exempt_placings?
  @rep.key? :'exempt placings'
end

#levelObject



35
36
37
# File 'lib/sciolyff/interpreter/tournament.rb', line 35

def level
  @rep[:level]
end


12
13
14
15
16
17
# File 'lib/sciolyff/interpreter/tournament.rb', line 12

def link_to_other_models(interpreter)
  @events = interpreter.events
  @teams = interpreter.teams
  @placings = interpreter.placings
  @penalties = interpreter.penalties
end

#locationObject



31
32
33
# File 'lib/sciolyff/interpreter/tournament.rb', line 31

def location
  @rep[:location]
end

#maximum_placeObject



75
76
77
78
79
# File 'lib/sciolyff/interpreter/tournament.rb', line 75

def maximum_place
  return @rep[:'maximum place'] if @rep[:'maximum place']

  @teams.count { |t| !t.exhibition? }
end

#nameObject



23
24
25
# File 'lib/sciolyff/interpreter/tournament.rb', line 23

def name
  @rep[:name]
end

#short_nameObject



27
28
29
# File 'lib/sciolyff/interpreter/tournament.rb', line 27

def short_name
  @rep[:'short name']
end

#stateObject



39
40
41
# File 'lib/sciolyff/interpreter/tournament.rb', line 39

def state
  @rep[:state]
end

#worst_placings_droppedObject



59
60
61
# File 'lib/sciolyff/interpreter/tournament.rb', line 59

def worst_placings_dropped
  worst_placings_dropped? ? @rep[:'worst placings dropped'] : 0
end

#worst_placings_dropped?Boolean

Returns:

  • (Boolean)


55
56
57
# File 'lib/sciolyff/interpreter/tournament.rb', line 55

def worst_placings_dropped?
  @rep.key? :'worst placings dropped'
end

#yearObject



47
48
49
# File 'lib/sciolyff/interpreter/tournament.rb', line 47

def year
  @rep[:year]
end