Class: BreatheIn::City

Inherits:
Object
  • Object
show all
Defined in:
lib/breathe_in/city.rb

Constant Summary collapse

@@cities =
[]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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_nameObject

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_indexObject

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_timeObject

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_valueObject

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_highObject

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_indexObject

Returns the value of attribute today_index.



2
3
4
# File 'lib/breathe_in/city.rb', line 2

def today_index
  @today_index
end

#zipcodeObject

Returns the value of attribute zipcode.



2
3
4
# File 'lib/breathe_in/city.rb', line 2

def zipcode
  @zipcode
end

Class Method Details

.citiesObject



16
17
18
# File 'lib/breathe_in/city.rb', line 16

def self.cities
  @@cities
end

.resetObject



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