Class: Sports::Ground
- Inherits:
-
Object
- Object
- Sports::Ground
- Defined in:
- lib/sportdb/structs/ground.rb
Instance Attribute Summary collapse
-
#address ⇒ Object
todo: use just names for alt_names - why? why not?.
-
#alt_names ⇒ Object
todo: use just names for alt_names - why? why not?.
-
#city ⇒ Object
todo: use just names for alt_names - why? why not?.
-
#country ⇒ Object
todo: use just names for alt_names - why? why not?.
-
#district ⇒ Object
todo: use just names for alt_names - why? why not?.
-
#geos ⇒ Object
todo: use just names for alt_names - why? why not?.
-
#key ⇒ Object
all names.
-
#name ⇒ Object
todo: use just names for alt_names - why? why not?.
-
#year ⇒ Object
todo: use just names for alt_names - why? why not?.
-
#year_end ⇒ Object
todo: use just names for alt_names - why? why not?.
Instance Method Summary collapse
-
#historic? ⇒ Boolean
(also: #past?)
todo/check check event_ifno - for start_date, end_date ?? use same naming convention here too (start_year/end_year).
-
#initialize(**kwargs) ⇒ Ground
constructor
A new instance of Ground.
- #names ⇒ Object
- #update(**kwargs) ⇒ Object
Constructor Details
#initialize(**kwargs) ⇒ Ground
Returns a new instance of Ground.
60 61 62 63 64 |
# File 'lib/sportdb/structs/ground.rb', line 60 def initialize( **kwargs ) @alt_names = [] update( **kwargs ) unless kwargs.empty? end |
Instance Attribute Details
#address ⇒ Object
todo: use just names for alt_names - why? why not?
11 12 13 |
# File 'lib/sportdb/structs/ground.rb', line 11 def address @address end |
#alt_names ⇒ Object
todo: use just names for alt_names - why? why not?
11 12 13 |
# File 'lib/sportdb/structs/ground.rb', line 11 def alt_names @alt_names end |
#city ⇒ Object
todo: use just names for alt_names - why? why not?
11 12 13 |
# File 'lib/sportdb/structs/ground.rb', line 11 def city @city end |
#country ⇒ Object
todo: use just names for alt_names - why? why not?
11 12 13 |
# File 'lib/sportdb/structs/ground.rb', line 11 def country @country end |
#district ⇒ Object
todo: use just names for alt_names - why? why not?
11 12 13 |
# File 'lib/sportdb/structs/ground.rb', line 11 def district @district end |
#geos ⇒ Object
todo: use just names for alt_names - why? why not?
11 12 13 |
# File 'lib/sportdb/structs/ground.rb', line 11 def geos @geos end |
#key ⇒ Object
all names
11 12 13 |
# File 'lib/sportdb/structs/ground.rb', line 11 def key @key end |
#name ⇒ Object
todo: use just names for alt_names - why? why not?
11 12 13 |
# File 'lib/sportdb/structs/ground.rb', line 11 def name @name end |
#year ⇒ Object
todo: use just names for alt_names - why? why not?
11 12 13 |
# File 'lib/sportdb/structs/ground.rb', line 11 def year @year end |
#year_end ⇒ Object
todo: use just names for alt_names - why? why not?
11 12 13 |
# File 'lib/sportdb/structs/ground.rb', line 11 def year_end @year_end end |
Instance Method Details
#historic? ⇒ Boolean Also known as: past?
todo/check
check event_ifno - for start_date, end_date ??
use same naming convention here too (start_year/end_year)
56 |
# File 'lib/sportdb/structs/ground.rb', line 56 def historic?() @year_end ? true : false; end |
#names ⇒ Object
18 19 20 21 |
# File 'lib/sportdb/structs/ground.rb', line 18 def names ## todo/check: add alt_names_auto too? - why? why not? [@name] + @alt_names end |
#update(**kwargs) ⇒ Object
66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/sportdb/structs/ground.rb', line 66 def update( **kwargs ) @key = kwargs[:key] if kwargs.has_key?( :key ) @name = kwargs[:name] if kwargs.has_key?( :name ) @alt_names = kwargs[:alt_names] if kwargs.has_key?( :alt_names ) @city = kwargs[:city] if kwargs.has_key?( :city ) ## todo/fix: use city struct - why? why not? ## todo/fix: add country too or report unused keywords / attributes - why? why not? self ## note - MUST return self for chaining end |