Class: YahooWeather::Atmosphere
- Inherits:
-
Object
- Object
- YahooWeather::Atmosphere
- Defined in:
- lib/yahoo_weather/atmosphere.rb
Defined Under Namespace
Classes: Barometer
Instance Attribute Summary collapse
-
#barometer ⇒ Object
readonly
Returns the value of attribute barometer.
-
#humidity ⇒ Object
readonly
Returns the value of attribute humidity.
-
#pressure ⇒ Object
readonly
Returns the value of attribute pressure.
-
#visibility ⇒ Object
readonly
Returns the value of attribute visibility.
Instance Method Summary collapse
-
#initialize(payload) ⇒ Atmosphere
constructor
A new instance of Atmosphere.
Constructor Details
#initialize(payload) ⇒ Atmosphere
Returns a new instance of Atmosphere.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/yahoo_weather/atmosphere.rb', line 13 def initialize(payload) @humidity = payload['humidity'].to_i @visibility = payload['visibility'].to_f @pressure = payload['pressure'].to_f # map barometric pressure direction to appropriate constant @barometer = nil case payload['rising'].to_i when 0 @barometer = Barometer::STEADY when 1 @barometer = Barometer::RISING when 2 @barometer = Barometer::FALLING end end |
Instance Attribute Details
#barometer ⇒ Object (readonly)
Returns the value of attribute barometer.
11 12 13 |
# File 'lib/yahoo_weather/atmosphere.rb', line 11 def @barometer end |
#humidity ⇒ Object (readonly)
Returns the value of attribute humidity.
11 12 13 |
# File 'lib/yahoo_weather/atmosphere.rb', line 11 def humidity @humidity end |
#pressure ⇒ Object (readonly)
Returns the value of attribute pressure.
11 12 13 |
# File 'lib/yahoo_weather/atmosphere.rb', line 11 def pressure @pressure end |
#visibility ⇒ Object (readonly)
Returns the value of attribute visibility.
11 12 13 |
# File 'lib/yahoo_weather/atmosphere.rb', line 11 def visibility @visibility end |