Class: SciolyFF::Interpreter::Tournament
- Defined in:
- lib/sciolyff/interpreter/tournament.rb
Overview
Models a Science Olympiad tournament
Instance Attribute Summary collapse
-
#events ⇒ Object
readonly
Returns the value of attribute events.
-
#penalties ⇒ Object
readonly
Returns the value of attribute penalties.
-
#placings ⇒ Object
readonly
Returns the value of attribute placings.
-
#teams ⇒ Object
readonly
Returns the value of attribute teams.
Attributes inherited from Model
Instance Method Summary collapse
- #custom_maximum_place? ⇒ Boolean
- #date ⇒ Object
- #division ⇒ Object
- #exempt_placings ⇒ Object
- #exempt_placings? ⇒ Boolean
-
#initialize(rep) ⇒ Tournament
constructor
A new instance of Tournament.
- #level ⇒ Object
- #link_to_other_models(interpreter) ⇒ Object
- #location ⇒ Object
- #maximum_place ⇒ Object
- #name ⇒ Object
- #short_name ⇒ Object
- #state ⇒ Object
- #worst_placings_dropped ⇒ Object
- #worst_placings_dropped? ⇒ Boolean
- #year ⇒ Object
Methods inherited from Model
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
#events ⇒ Object (readonly)
Returns the value of attribute events.
19 20 21 |
# File 'lib/sciolyff/interpreter/tournament.rb', line 19 def events @events end |
#penalties ⇒ Object (readonly)
Returns the value of attribute penalties.
19 20 21 |
# File 'lib/sciolyff/interpreter/tournament.rb', line 19 def penalties @penalties end |
#placings ⇒ Object (readonly)
Returns the value of attribute placings.
19 20 21 |
# File 'lib/sciolyff/interpreter/tournament.rb', line 19 def placings @placings end |
#teams ⇒ Object (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
71 72 73 |
# File 'lib/sciolyff/interpreter/tournament.rb', line 71 def custom_maximum_place? maximum_place != @teams.count { |t| !t.exhibition? } end |
#date ⇒ Object
51 52 53 |
# File 'lib/sciolyff/interpreter/tournament.rb', line 51 def date @rep[:date] end |
#division ⇒ Object
43 44 45 |
# File 'lib/sciolyff/interpreter/tournament.rb', line 43 def division @rep[:division] end |
#exempt_placings ⇒ Object
67 68 69 |
# File 'lib/sciolyff/interpreter/tournament.rb', line 67 def exempt_placings exempt_placings? ? @rep[:'exempt placings'] : 0 end |
#exempt_placings? ⇒ Boolean
63 64 65 |
# File 'lib/sciolyff/interpreter/tournament.rb', line 63 def exempt_placings? @rep.key? :'exempt placings' end |
#level ⇒ Object
35 36 37 |
# File 'lib/sciolyff/interpreter/tournament.rb', line 35 def level @rep[:level] end |
#link_to_other_models(interpreter) ⇒ Object
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 |
#location ⇒ Object
31 32 33 |
# File 'lib/sciolyff/interpreter/tournament.rb', line 31 def location @rep[:location] end |
#maximum_place ⇒ Object
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 |
#name ⇒ Object
23 24 25 |
# File 'lib/sciolyff/interpreter/tournament.rb', line 23 def name @rep[:name] end |
#short_name ⇒ Object
27 28 29 |
# File 'lib/sciolyff/interpreter/tournament.rb', line 27 def short_name @rep[:'short name'] end |
#state ⇒ Object
39 40 41 |
# File 'lib/sciolyff/interpreter/tournament.rb', line 39 def state @rep[:state] end |
#worst_placings_dropped ⇒ Object
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
55 56 57 |
# File 'lib/sciolyff/interpreter/tournament.rb', line 55 def worst_placings_dropped? @rep.key? :'worst placings dropped' end |
#year ⇒ Object
47 48 49 |
# File 'lib/sciolyff/interpreter/tournament.rb', line 47 def year @rep[:year] end |