Class: WorldDb::Model::CitySerializer
- Inherits:
-
Object
- Object
- WorldDb::Model::CitySerializer
- Defined in:
- lib/worlddb/serializers/city.rb
Overview
todo/check:
add as_row to CityBase for all classes - why? why not??
Instance Attribute Summary collapse
-
#city ⇒ Object
readonly
Returns the value of attribute city.
Instance Method Summary collapse
- #as_row ⇒ Object
-
#initialize(city) ⇒ CitySerializer
constructor
A new instance of CitySerializer.
Constructor Details
#initialize(city) ⇒ CitySerializer
Returns a new instance of CitySerializer.
11 12 13 |
# File 'lib/worlddb/serializers/city.rb', line 11 def initialize( city ) @city = city end |
Instance Attribute Details
#city ⇒ Object (readonly)
Returns the value of attribute city.
15 16 17 |
# File 'lib/worlddb/serializers/city.rb', line 15 def city @city end |
Instance Method Details
#as_row ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/worlddb/serializers/city.rb', line 17 def as_row ## add virtual column like kind for metro, metro|city, city, district ## todo add region.title if present ## todo add metro.name if available - why? why not?? data = { key: city.key, name: city.name, code: city.code, pop: city.pop, area: city.area, synonyms: city.synonyms, country: city.country.name } data end |