Class: UndergroundWeather::Forecast

Inherits:
Object
  • Object
show all
Defined in:
lib/undergroundweather/features/forecast.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(feed) ⇒ Forecast

Returns a new instance of Forecast.



5
6
7
8
9
10
11
12
13
14
# File 'lib/undergroundweather/features/forecast.rb', line 5

def initialize(feed)
  days = []
  feed['forecast']['simpleforecast']['forecastday'].each do |daily|
    days << DailyForecast.new(daily)
  end  
  
  days.each do |d|
    instance_variable_set("@#{d.day.downcase}", d)
  end  
end

Instance Attribute Details

#fridayObject (readonly)

Returns the value of attribute friday.



3
4
5
# File 'lib/undergroundweather/features/forecast.rb', line 3

def friday
  @friday
end

#mondayObject (readonly)

Returns the value of attribute monday.



3
4
5
# File 'lib/undergroundweather/features/forecast.rb', line 3

def monday
  @monday
end

#saturdayObject (readonly)

Returns the value of attribute saturday.



3
4
5
# File 'lib/undergroundweather/features/forecast.rb', line 3

def saturday
  @saturday
end

#sundayObject (readonly)

Returns the value of attribute sunday.



3
4
5
# File 'lib/undergroundweather/features/forecast.rb', line 3

def sunday
  @sunday
end

#thursdayObject (readonly)

Returns the value of attribute thursday.



3
4
5
# File 'lib/undergroundweather/features/forecast.rb', line 3

def thursday
  @thursday
end

#tuesdayObject (readonly)

Returns the value of attribute tuesday.



3
4
5
# File 'lib/undergroundweather/features/forecast.rb', line 3

def tuesday
  @tuesday
end

#wednesdayObject (readonly)

Returns the value of attribute wednesday.



3
4
5
# File 'lib/undergroundweather/features/forecast.rb', line 3

def wednesday
  @wednesday
end