Class: Hamweather::Forecast::Daily

Inherits:
Object
  • Object
show all
Defined in:
lib/hamweather/forecast/daily.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(daily_forecast) ⇒ Daily

Returns a new instance of Daily.



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/hamweather/forecast/daily.rb', line 7

def initialize(daily_forecast)
  @hours = {}
  @high_farenheit = daily_forecast[:hif].to_i
  @high_celsius = daily_forecast[:hic].to_i
  @low_farenheit = daily_forecast[:lof].to_i
  @low_celsius = daily_forecast[:loc].to_i
  @date = Date.parse(daily_forecast[:date])
  @expected_weather = daily_forecast[:wx]
  @detail = daily_forecast[:detail]
  @probability_of_preciptiation = daily_forecast[:pop].to_i
end

Instance Attribute Details

#dateObject

daily_forecast = Hpricot.parse(‘<FPeriod interval=“1” Day=“FRI” Date=“2008-11-14” Wx=“Chance T-storms” Icon=“tstorm.gif” HiF=“66” HiC=“19” LoF=“56” LoC=“13” Pop=“60” Detail=“Occasional showers with a chance of thunderstorms. Areas of fog. Some thunderstorms May be severe after midnight. Lows in the mid 50s. South winds 5 to 10 mph shifting to the southwest 10 to 15 mph after midnight. Chance of rain near 100 percent.”/>’).root



4
5
6
# File 'lib/hamweather/forecast/daily.rb', line 4

def date
  @date
end

#dayObject

daily_forecast = Hpricot.parse(‘<FPeriod interval=“1” Day=“FRI” Date=“2008-11-14” Wx=“Chance T-storms” Icon=“tstorm.gif” HiF=“66” HiC=“19” LoF=“56” LoC=“13” Pop=“60” Detail=“Occasional showers with a chance of thunderstorms. Areas of fog. Some thunderstorms May be severe after midnight. Lows in the mid 50s. South winds 5 to 10 mph shifting to the southwest 10 to 15 mph after midnight. Chance of rain near 100 percent.”/>’).root



4
5
6
# File 'lib/hamweather/forecast/daily.rb', line 4

def day
  @day
end

#detailObject

daily_forecast = Hpricot.parse(‘<FPeriod interval=“1” Day=“FRI” Date=“2008-11-14” Wx=“Chance T-storms” Icon=“tstorm.gif” HiF=“66” HiC=“19” LoF=“56” LoC=“13” Pop=“60” Detail=“Occasional showers with a chance of thunderstorms. Areas of fog. Some thunderstorms May be severe after midnight. Lows in the mid 50s. South winds 5 to 10 mph shifting to the southwest 10 to 15 mph after midnight. Chance of rain near 100 percent.”/>’).root



4
5
6
# File 'lib/hamweather/forecast/daily.rb', line 4

def detail
  @detail
end

#expected_weatherObject

daily_forecast = Hpricot.parse(‘<FPeriod interval=“1” Day=“FRI” Date=“2008-11-14” Wx=“Chance T-storms” Icon=“tstorm.gif” HiF=“66” HiC=“19” LoF=“56” LoC=“13” Pop=“60” Detail=“Occasional showers with a chance of thunderstorms. Areas of fog. Some thunderstorms May be severe after midnight. Lows in the mid 50s. South winds 5 to 10 mph shifting to the southwest 10 to 15 mph after midnight. Chance of rain near 100 percent.”/>’).root



4
5
6
# File 'lib/hamweather/forecast/daily.rb', line 4

def expected_weather
  @expected_weather
end

#high_celsiusObject

daily_forecast = Hpricot.parse(‘<FPeriod interval=“1” Day=“FRI” Date=“2008-11-14” Wx=“Chance T-storms” Icon=“tstorm.gif” HiF=“66” HiC=“19” LoF=“56” LoC=“13” Pop=“60” Detail=“Occasional showers with a chance of thunderstorms. Areas of fog. Some thunderstorms May be severe after midnight. Lows in the mid 50s. South winds 5 to 10 mph shifting to the southwest 10 to 15 mph after midnight. Chance of rain near 100 percent.”/>’).root



4
5
6
# File 'lib/hamweather/forecast/daily.rb', line 4

def high_celsius
  @high_celsius
end

#high_farenheitObject

daily_forecast = Hpricot.parse(‘<FPeriod interval=“1” Day=“FRI” Date=“2008-11-14” Wx=“Chance T-storms” Icon=“tstorm.gif” HiF=“66” HiC=“19” LoF=“56” LoC=“13” Pop=“60” Detail=“Occasional showers with a chance of thunderstorms. Areas of fog. Some thunderstorms May be severe after midnight. Lows in the mid 50s. South winds 5 to 10 mph shifting to the southwest 10 to 15 mph after midnight. Chance of rain near 100 percent.”/>’).root



4
5
6
# File 'lib/hamweather/forecast/daily.rb', line 4

def high_farenheit
  @high_farenheit
end

#hoursObject

Returns the value of attribute hours.



5
6
7
# File 'lib/hamweather/forecast/daily.rb', line 5

def hours
  @hours
end

#low_celsiusObject

daily_forecast = Hpricot.parse(‘<FPeriod interval=“1” Day=“FRI” Date=“2008-11-14” Wx=“Chance T-storms” Icon=“tstorm.gif” HiF=“66” HiC=“19” LoF=“56” LoC=“13” Pop=“60” Detail=“Occasional showers with a chance of thunderstorms. Areas of fog. Some thunderstorms May be severe after midnight. Lows in the mid 50s. South winds 5 to 10 mph shifting to the southwest 10 to 15 mph after midnight. Chance of rain near 100 percent.”/>’).root



4
5
6
# File 'lib/hamweather/forecast/daily.rb', line 4

def low_celsius
  @low_celsius
end

#low_farenheitObject

daily_forecast = Hpricot.parse(‘<FPeriod interval=“1” Day=“FRI” Date=“2008-11-14” Wx=“Chance T-storms” Icon=“tstorm.gif” HiF=“66” HiC=“19” LoF=“56” LoC=“13” Pop=“60” Detail=“Occasional showers with a chance of thunderstorms. Areas of fog. Some thunderstorms May be severe after midnight. Lows in the mid 50s. South winds 5 to 10 mph shifting to the southwest 10 to 15 mph after midnight. Chance of rain near 100 percent.”/>’).root



4
5
6
# File 'lib/hamweather/forecast/daily.rb', line 4

def low_farenheit
  @low_farenheit
end

#probability_of_preciptiationObject

daily_forecast = Hpricot.parse(‘<FPeriod interval=“1” Day=“FRI” Date=“2008-11-14” Wx=“Chance T-storms” Icon=“tstorm.gif” HiF=“66” HiC=“19” LoF=“56” LoC=“13” Pop=“60” Detail=“Occasional showers with a chance of thunderstorms. Areas of fog. Some thunderstorms May be severe after midnight. Lows in the mid 50s. South winds 5 to 10 mph shifting to the southwest 10 to 15 mph after midnight. Chance of rain near 100 percent.”/>’).root



4
5
6
# File 'lib/hamweather/forecast/daily.rb', line 4

def probability_of_preciptiation
  @probability_of_preciptiation
end

Instance Method Details

#each_hourObject



19
20
21
22
23
# File 'lib/hamweather/forecast/daily.rb', line 19

def each_hour
  @hours.each_pair do |key, value|
    yield value
  end
end