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