Class: Sports::Country

Inherits:
Object
  • Object
show all
Defined in:
lib/sports/structs/country.rb

Overview

note: check that shape/structure/fields/attributes match

the ActiveRecord model !!!!

Instance Attribute Summary collapse

Instance Method Summary collapse

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           = tags
end

Instance Attribute Details

#alt_namesObject

Returns the value of attribute alt_names.



12
13
14
# File 'lib/sports/structs/country.rb', line 12

def alt_names
  @alt_names
end

#codeObject (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

#keyObject (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

#nameObject (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

#tagsObject (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
  @tags
end