Class: YahooWeather::Forecast
- Inherits:
-
Object
- Object
- YahooWeather::Forecast
- Defined in:
- lib/yahoo_weather/forecast.rb
Instance Attribute Summary collapse
-
#date ⇒ Object
readonly
Returns the value of attribute date.
-
#day ⇒ Object
readonly
Returns the value of attribute day.
-
#high ⇒ Object
readonly
Returns the value of attribute high.
-
#low ⇒ Object
readonly
Returns the value of attribute low.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Instance Method Summary collapse
- #code(u = 'integer') ⇒ Object
-
#initialize(payload) ⇒ Forecast
constructor
A new instance of Forecast.
Constructor Details
#initialize(payload) ⇒ Forecast
Returns a new instance of Forecast.
4 5 6 7 8 9 10 11 |
# File 'lib/yahoo_weather/forecast.rb', line 4 def initialize(payload) @date = Date.parse(payload['date']) @text = payload['text'] @day = payload['day'] @code = payload['code'].to_i @high = payload['high'].to_i @low = payload['low'].to_i end |
Instance Attribute Details
#date ⇒ Object (readonly)
Returns the value of attribute date.
2 3 4 |
# File 'lib/yahoo_weather/forecast.rb', line 2 def date @date end |
#day ⇒ Object (readonly)
Returns the value of attribute day.
2 3 4 |
# File 'lib/yahoo_weather/forecast.rb', line 2 def day @day end |
#high ⇒ Object (readonly)
Returns the value of attribute high.
2 3 4 |
# File 'lib/yahoo_weather/forecast.rb', line 2 def high @high end |
#low ⇒ Object (readonly)
Returns the value of attribute low.
2 3 4 |
# File 'lib/yahoo_weather/forecast.rb', line 2 def low @low end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
2 3 4 |
# File 'lib/yahoo_weather/forecast.rb', line 2 def text @text end |
Instance Method Details
#code(u = 'integer') ⇒ Object
13 14 15 16 |
# File 'lib/yahoo_weather/forecast.rb', line 13 def code(u='integer') return @code if u == 'integer' YahooWeather.code_string(@code) end |