Class: OpenWeatherMap::City
- Inherits:
-
Object
- Object
- OpenWeatherMap::City
- Defined in:
- lib/openweathermap/classes.rb
Overview
Represents a city
Instance Attribute Summary collapse
-
#coordinates ⇒ Coordinates
readonly
City’s coordinates.
-
#country ⇒ String
readonly
Country in which the city is.
-
#name ⇒ String
readonly
City’s name.
Instance Method Summary collapse
-
#initialize(name, lon, lat, country) ⇒ City
constructor
Create a new City object.
Constructor Details
#initialize(name, lon, lat, country) ⇒ City
Create a new City object
19 20 21 22 23 |
# File 'lib/openweathermap/classes.rb', line 19 def initialize(name, lon, lat, country) @name = name @coordinates = OpenWeatherMap::Coordinates.new(lon, lat) @country = country end |
Instance Attribute Details
#coordinates ⇒ Coordinates (readonly)
Returns City’s coordinates.
8 9 10 |
# File 'lib/openweathermap/classes.rb', line 8 def coordinates @coordinates end |
#country ⇒ String (readonly)
Returns Country in which the city is.
11 12 13 |
# File 'lib/openweathermap/classes.rb', line 11 def country @country end |
#name ⇒ String (readonly)
Returns City’s name.
5 6 7 |
# File 'lib/openweathermap/classes.rb', line 5 def name @name end |