Class: Weather::Current
- Inherits:
-
Object
- Object
- Weather::Current
- Defined in:
- lib/current.rb
Instance Attribute Summary collapse
-
#doc ⇒ Object
readonly
Returns the value of attribute doc.
Instance Method Summary collapse
-
#date ⇒ Object
Forecast date.
-
#description ⇒ Object
Outlook message.
-
#icon ⇒ Object
Icon to be displayed.
-
#initialize(doc) ⇒ Current
constructor
A new instance of Current.
-
#last_update ⇒ Object
Last update (current).
-
#temp ⇒ Object
Temperature.
-
#wind ⇒ Object
Wind conditions.
Constructor Details
#initialize(doc) ⇒ Current
Returns a new instance of Current.
10 11 12 |
# File 'lib/current.rb', line 10 def initialize(doc) @doc = doc end |
Instance Attribute Details
#doc ⇒ Object (readonly)
Returns the value of attribute doc.
8 9 10 |
# File 'lib/current.rb', line 8 def doc @doc end |
Instance Method Details
#date ⇒ Object
Forecast date
25 26 27 |
# File 'lib/current.rb', line 25 def date Time.now end |
#description ⇒ Object
Outlook message
20 21 22 |
# File 'lib/current.rb', line 20 def description doc.at("t").innerHTML end |
#icon ⇒ Object
Icon to be displayed
15 16 17 |
# File 'lib/current.rb', line 15 def icon doc.at("icon").innerHTML end |
#last_update ⇒ Object
Last update (current)
35 36 37 |
# File 'lib/current.rb', line 35 def last_update Time.parse(doc.at("lsup").innerHTML) end |
#temp ⇒ Object
Temperature
30 31 32 |
# File 'lib/current.rb', line 30 def temp doc.at("tmp").innerHTML end |