Class: FtcEvent::Team
- Inherits:
-
Object
- Object
- FtcEvent::Team
- Defined in:
- lib/ftc_event/team.rb
Instance Attribute Summary collapse
-
#event ⇒ Object
readonly
Returns the value of attribute event.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
Instance Method Summary collapse
- #city ⇒ Object
- #country ⇒ Object
- #description ⇒ Object
- #full_description ⇒ Object
- #info ⇒ Object
-
#initialize(event, number) ⇒ Team
constructor
A new instance of Team.
- #location ⇒ Object
- #name ⇒ Object
- #school ⇒ Object
- #state ⇒ Object
Constructor Details
#initialize(event, number) ⇒ Team
Returns a new instance of Team.
8 9 10 11 |
# File 'lib/ftc_event/team.rb', line 8 def initialize(event, number) @event = event @number = number end |
Instance Attribute Details
#event ⇒ Object (readonly)
Returns the value of attribute event.
5 6 7 |
# File 'lib/ftc_event/team.rb', line 5 def event @event end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
6 7 8 |
# File 'lib/ftc_event/team.rb', line 6 def number @number end |
Instance Method Details
#city ⇒ Object
25 26 27 |
# File 'lib/ftc_event/team.rb', line 25 def city info && info['city'].strip end |
#country ⇒ Object
33 34 35 |
# File 'lib/ftc_event/team.rb', line 33 def country info && info['country'].strip end |
#description ⇒ Object
47 48 49 |
# File 'lib/ftc_event/team.rb', line 47 def description "#{number} #{name}" end |
#full_description ⇒ Object
51 52 53 |
# File 'lib/ftc_event/team.rb', line 51 def full_description "#{description} from #{location}" end |
#info ⇒ Object
13 14 15 |
# File 'lib/ftc_event/team.rb', line 13 def info event.db.query('SELECT * FROM teamInfo WHERE number = ?', [number])&.first end |
#location ⇒ Object
37 38 39 40 41 42 43 44 45 |
# File 'lib/ftc_event/team.rb', line 37 def location return unless info [ city, state, country != 'USA' ? country : nil ].reject(&:nil?).join(', ') end |
#name ⇒ Object
17 18 19 |
# File 'lib/ftc_event/team.rb', line 17 def name info && info['name'].strip end |
#school ⇒ Object
21 22 23 |
# File 'lib/ftc_event/team.rb', line 21 def school info && info['school'].strip end |
#state ⇒ Object
29 30 31 |
# File 'lib/ftc_event/team.rb', line 29 def state info && info['state'].strip end |