Class: Weather

Inherits:
Object
  • Object
show all
Defined in:
lib/weather_usa/weather.rb

Constant Summary collapse

@@all =
[]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(weather_hash) ⇒ Weather

Returns a new instance of Weather.



7
8
9
10
11
12
# File 'lib/weather_usa/weather.rb', line 7

def initialize(weather_hash)
  weather_hash.each do |k, v|
    self.send "#{k}=", v         
  end    
  @@all << self
end

Instance Attribute Details

#currentObject

Returns the value of attribute current.



2
3
4
# File 'lib/weather_usa/weather.rb', line 2

def current
  @current
end

#detailed_forecastObject

Returns the value of attribute detailed_forecast.



2
3
4
# File 'lib/weather_usa/weather.rb', line 2

def detailed_forecast
  @detailed_forecast
end

#is_daytimeObject

Returns the value of attribute is_daytime.



2
3
4
# File 'lib/weather_usa/weather.rb', line 2

def is_daytime
  @is_daytime
end

#nameObject

Returns the value of attribute name.



2
3
4
# File 'lib/weather_usa/weather.rb', line 2

def name
  @name
end

#numberObject

Returns the value of attribute number.



2
3
4
# File 'lib/weather_usa/weather.rb', line 2

def number
  @number
end

#short_forecastObject

Returns the value of attribute short_forecast.



2
3
4
# File 'lib/weather_usa/weather.rb', line 2

def short_forecast
  @short_forecast
end

#temperatureObject

Returns the value of attribute temperature.



2
3
4
# File 'lib/weather_usa/weather.rb', line 2

def temperature
  @temperature
end

#wind_directionObject

Returns the value of attribute wind_direction.



2
3
4
# File 'lib/weather_usa/weather.rb', line 2

def wind_direction
  @wind_direction
end

#wind_speedObject

Returns the value of attribute wind_speed.



2
3
4
# File 'lib/weather_usa/weather.rb', line 2

def wind_speed
  @wind_speed
end

Class Method Details

.allObject



14
15
16
# File 'lib/weather_usa/weather.rb', line 14

def self.all
  @@all
end

.clear_allObject



18
19
20
# File 'lib/weather_usa/weather.rb', line 18

def self.clear_all
  @@all = []
end