Class: Sundown::Location
- Inherits:
-
Object
- Object
- Sundown::Location
- Defined in:
- lib/sundown/location.rb
Overview
Main class to accomodate core-features, saves weather instance once called.
Instance Method Summary collapse
-
#initialize(location) ⇒ Location
constructor
A new instance of Location.
- #refresh ⇒ Object
- #temperature(degree = 'f') ⇒ Object
- #timestamp ⇒ Object
Constructor Details
#initialize(location) ⇒ Location
Returns a new instance of Location.
4 5 6 |
# File 'lib/sundown/location.rb', line 4 def initialize(location) @location = location end |
Instance Method Details
#refresh ⇒ Object
22 23 24 |
# File 'lib/sundown/location.rb', line 22 def refresh @weather = nil end |
#temperature(degree = 'f') ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/sundown/location.rb', line 8 def temperature(degree = 'f') if degree == 'c' (weather['query']['results']['channel']['item']['condition']['temp'] .to_f - 32) * 0.5556 else weather['query']['results']['channel']['item']['condition']['temp'] .to_f end end |
#timestamp ⇒ Object
18 19 20 |
# File 'lib/sundown/location.rb', line 18 def weather['query']['results']['channel']['item']['condition']['date'] end |