Class: Sports::City

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

Overview

add city here

use module World - why? why not?

Instance Attribute Summary collapse

Instance Method Summary collapse

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_namesObject

Returns the value of attribute alt_names.



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

def alt_names
  @alt_names
end

#countryObject (readonly)

Returns the value of attribute country.



11
12
13
# File 'lib/sportdb/structs/country.rb', line 11

def country
  @country
end

#keyObject (readonly)

Returns the value of attribute key.



11
12
13
# File 'lib/sportdb/structs/country.rb', line 11

def key
  @key
end

#nameObject (readonly)

Returns the value of attribute name.



11
12
13
# File 'lib/sportdb/structs/country.rb', line 11

def name
  @name
end