Class: Sports::Country
- Inherits:
-
Object
- Object
- Sports::Country
- Defined in:
- lib/sportdb/structs/structs/country.rb
Instance Attribute Summary collapse
-
#alt_names ⇒ Object
Returns the value of attribute alt_names.
-
#code ⇒ Object
readonly
note: is read-only/immutable for now - why? why not? add cities (array/list) - why? why not?.
-
#key ⇒ Object
readonly
note: is read-only/immutable for now - why? why not? add cities (array/list) - why? why not?.
-
#name ⇒ Object
readonly
note: is read-only/immutable for now - why? why not? add cities (array/list) - why? why not?.
-
#tags ⇒ Object
readonly
note: is read-only/immutable for now - why? why not? add cities (array/list) - why? why not?.
Instance Method Summary collapse
-
#initialize(key: nil, name:, code:, tags: []) ⇒ Country
constructor
A new instance of Country.
Constructor Details
#initialize(key: nil, name:, code:, tags: []) ⇒ Country
Returns a new instance of Country.
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/sportdb/structs/structs/country.rb', line 33 def initialize( key: nil, name:, code:, tags: [] ) ## 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 = begin if key key elsif code code.downcase else unaccent( name ).downcase.gsub( /[^a-z]/, '' ) end end @name, @code = name, code @alt_names = [] @tags = end |
Instance Attribute Details
#alt_names ⇒ Object
Returns the value of attribute alt_names.
31 32 33 |
# File 'lib/sportdb/structs/structs/country.rb', line 31 def alt_names @alt_names end |
#code ⇒ Object (readonly)
note: is read-only/immutable for now - why? why not?
add cities (array/list) - why? why not?
30 31 32 |
# File 'lib/sportdb/structs/structs/country.rb', line 30 def code @code end |
#key ⇒ Object (readonly)
note: is read-only/immutable for now - why? why not?
add cities (array/list) - why? why not?
30 31 32 |
# File 'lib/sportdb/structs/structs/country.rb', line 30 def key @key end |
#name ⇒ Object (readonly)
note: is read-only/immutable for now - why? why not?
add cities (array/list) - why? why not?
30 31 32 |
# File 'lib/sportdb/structs/structs/country.rb', line 30 def name @name end |
#tags ⇒ Object (readonly)
note: is read-only/immutable for now - why? why not?
add cities (array/list) - why? why not?
30 31 32 |
# File 'lib/sportdb/structs/structs/country.rb', line 30 def @tags end |