Class: OpenWeatherMap::City
- Inherits:
-
Object
- Object
- OpenWeatherMap::City
- Defined in:
- lib/openweathermap/classes.rb
Overview
Class representing 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
33 34 35 36 37 |
# File 'lib/openweathermap/classes.rb', line 33 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.
18 19 20 |
# File 'lib/openweathermap/classes.rb', line 18 def coordinates @coordinates end |
#country ⇒ String (readonly)
Returns Country in which the city is.
23 24 25 |
# File 'lib/openweathermap/classes.rb', line 23 def country @country end |
#name ⇒ String (readonly)
Returns City’s name.
13 14 15 |
# File 'lib/openweathermap/classes.rb', line 13 def name @name end |