Class: Accuweather::Location::City
- Inherits:
-
Object
- Object
- Accuweather::Location::City
- Defined in:
- lib/accuweather/location/city.rb
Instance Attribute Summary collapse
-
#city ⇒ Object
readonly
Returns the value of attribute city.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#latitude ⇒ Object
readonly
Returns the value of attribute latitude.
-
#longitude ⇒ Object
readonly
Returns the value of attribute longitude.
-
#state ⇒ Object
readonly
Returns the value of attribute state.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(id:, city:, state:, latitude:, longitude:) ⇒ City
constructor
A new instance of City.
- #to_s ⇒ Object
Constructor Details
#initialize(id:, city:, state:, latitude:, longitude:) ⇒ City
Returns a new instance of City.
6 7 8 9 10 11 12 |
# File 'lib/accuweather/location/city.rb', line 6 def initialize(id:, city:, state:, latitude:, longitude:) @id = id @city = city @state = state @latitude = latitude @longitude = longitude end |
Instance Attribute Details
#city ⇒ Object (readonly)
Returns the value of attribute city.
4 5 6 |
# File 'lib/accuweather/location/city.rb', line 4 def city @city end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
4 5 6 |
# File 'lib/accuweather/location/city.rb', line 4 def id @id end |
#latitude ⇒ Object (readonly)
Returns the value of attribute latitude.
4 5 6 |
# File 'lib/accuweather/location/city.rb', line 4 def latitude @latitude end |
#longitude ⇒ Object (readonly)
Returns the value of attribute longitude.
4 5 6 |
# File 'lib/accuweather/location/city.rb', line 4 def longitude @longitude end |
#state ⇒ Object (readonly)
Returns the value of attribute state.
4 5 6 |
# File 'lib/accuweather/location/city.rb', line 4 def state @state end |
Instance Method Details
#==(other) ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/accuweather/location/city.rb', line 14 def ==(other) id == other.id && city == other.city && state == other.state && latitude == other.latitude && longitude == other.longitude rescue NoMethodError false end |
#to_s ⇒ Object
24 25 26 |
# File 'lib/accuweather/location/city.rb', line 24 def to_s "id: #{id}, city: #{city}, state: #{state}, latitude: #{latitude}, longitude: #{longitude}" end |