Class: Sports::City
- Inherits:
-
Object
- Object
- Sports::City
- Defined in:
- lib/sportdb/structs/country.rb
Overview
add city here
use module World - why? why not?
Instance Attribute Summary collapse
-
#alt_names ⇒ Object
Returns the value of attribute alt_names.
-
#country ⇒ Object
readonly
Returns the value of attribute country.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(key: nil, name:, country:) ⇒ City
constructor
A new instance of City.
Constructor Details
#initialize(key: nil, name:, country:) ⇒ City
Returns a new instance of City.
14 15 16 17 18 19 20 21 22 |
# File 'lib/sportdb/structs/country.rb', line 14 def initialize( key: nil, name:, country: ) ## note: auto-generate key "on-the-fly" if missing for now - why? why not? ## note: quick hack - auto-generate key, that is, remove all non-ascii chars and downcase @key = key || unaccent(name).downcase.gsub( /[^a-z]/, '' ) + "_" + country.key @name = name @country = country @alt_names = [] end |
Instance Attribute Details
#alt_names ⇒ Object
Returns the value of attribute alt_names.
12 13 14 |
# File 'lib/sportdb/structs/country.rb', line 12 def alt_names @alt_names end |
#country ⇒ Object (readonly)
Returns the value of attribute country.
11 12 13 |
# File 'lib/sportdb/structs/country.rb', line 11 def country @country end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
11 12 13 |
# File 'lib/sportdb/structs/country.rb', line 11 def key @key end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
11 12 13 |
# File 'lib/sportdb/structs/country.rb', line 11 def name @name end |