Class: Sports::Country
- Inherits:
-
Object
- Object
- Sports::Country
- Defined in:
- lib/sports/structs/country.rb
Overview
note: check that shape/structure/fields/attributes match
the ActiveRecord model !!!!
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.
14 15 16 17 18 19 20 21 |
# File 'lib/sports/structs/country.rb', line 14 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 = key || name.downcase.gsub( /[^a-z]/, '' ) @name, @code = name, code @alt_names = [] @tags = end |
Instance Attribute Details
#alt_names ⇒ Object
Returns the value of attribute alt_names.
12 13 14 |
# File 'lib/sports/structs/country.rb', line 12 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?
11 12 13 |
# File 'lib/sports/structs/country.rb', line 11 def code @code end |
#key ⇒ Object (readonly)
note: is read-only/immutable for now - why? why not?
add cities (array/list) - why? why not?
11 12 13 |
# File 'lib/sports/structs/country.rb', line 11 def key @key end |
#name ⇒ Object (readonly)
note: is read-only/immutable for now - why? why not?
add cities (array/list) - why? why not?
11 12 13 |
# File 'lib/sports/structs/country.rb', line 11 def name @name end |
#tags ⇒ Object (readonly)
note: is read-only/immutable for now - why? why not?
add cities (array/list) - why? why not?
11 12 13 |
# File 'lib/sports/structs/country.rb', line 11 def @tags end |