Class: BreatheIn::City
- Inherits:
-
Object
- Object
- BreatheIn::City
- Defined in:
- lib/breathe_in/city.rb
Constant Summary collapse
- @@cities =
[]
Instance Attribute Summary collapse
-
#city_name ⇒ Object
Returns the value of attribute city_name.
-
#last_update_index ⇒ Object
Returns the value of attribute last_update_index.
-
#last_update_time ⇒ Object
Returns the value of attribute last_update_time.
-
#last_update_value ⇒ Object
Returns the value of attribute last_update_value.
-
#today_high ⇒ Object
Returns the value of attribute today_high.
-
#today_index ⇒ Object
Returns the value of attribute today_index.
-
#zipcode ⇒ Object
Returns the value of attribute zipcode.
Class Method Summary collapse
Instance Method Summary collapse
- #add_city_air_quality(air_quality_hash) ⇒ Object
-
#initialize(city_hash = {}) ⇒ City
constructor
A new instance of City.
Constructor Details
#initialize(city_hash = {}) ⇒ City
Returns a new instance of City.
6 7 8 9 |
# File 'lib/breathe_in/city.rb', line 6 def initialize(city_hash={}) city_hash.each { |key, value| self.send(("#{key}="), value) } @@cities << self end |
Instance Attribute Details
#city_name ⇒ Object
Returns the value of attribute city_name.
2 3 4 |
# File 'lib/breathe_in/city.rb', line 2 def city_name @city_name end |
#last_update_index ⇒ Object
Returns the value of attribute last_update_index.
2 3 4 |
# File 'lib/breathe_in/city.rb', line 2 def last_update_index @last_update_index end |
#last_update_time ⇒ Object
Returns the value of attribute last_update_time.
2 3 4 |
# File 'lib/breathe_in/city.rb', line 2 def last_update_time @last_update_time end |
#last_update_value ⇒ Object
Returns the value of attribute last_update_value.
2 3 4 |
# File 'lib/breathe_in/city.rb', line 2 def last_update_value @last_update_value end |
#today_high ⇒ Object
Returns the value of attribute today_high.
2 3 4 |
# File 'lib/breathe_in/city.rb', line 2 def today_high @today_high end |
#today_index ⇒ Object
Returns the value of attribute today_index.
2 3 4 |
# File 'lib/breathe_in/city.rb', line 2 def today_index @today_index end |
#zipcode ⇒ Object
Returns the value of attribute zipcode.
2 3 4 |
# File 'lib/breathe_in/city.rb', line 2 def zipcode @zipcode end |
Class Method Details
.cities ⇒ Object
16 17 18 |
# File 'lib/breathe_in/city.rb', line 16 def self.cities @@cities end |
.reset ⇒ Object
20 21 22 |
# File 'lib/breathe_in/city.rb', line 20 def self.reset @@cities.clear end |
Instance Method Details
#add_city_air_quality(air_quality_hash) ⇒ Object
11 12 13 14 |
# File 'lib/breathe_in/city.rb', line 11 def add_city_air_quality(air_quality_hash) air_quality_hash.each { |key, value| self.send(("#{key}="), value) } self end |