Class: Yweather::Atmosphere
- Inherits:
-
Object
- Object
- Yweather::Atmosphere
- Defined in:
- lib/yweather/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(data) ⇒ Atmosphere
constructor
A new instance of Atmosphere.
Constructor Details
#initialize(data) ⇒ Atmosphere
Returns a new instance of Atmosphere.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/yweather/atmosphere.rb', line 18 def initialize(data) @humidity = data[:humidity].to_i @visibility = data[:visibility].to_i @pressure = data[:pressure].to_f @barometer = nil case data[: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.
16 17 18 |
# File 'lib/yweather/atmosphere.rb', line 16 def @barometer end |
#humidity ⇒ Object (readonly)
Returns the value of attribute humidity.
13 14 15 |
# File 'lib/yweather/atmosphere.rb', line 13 def humidity @humidity end |
#pressure ⇒ Object (readonly)
Returns the value of attribute pressure.
15 16 17 |
# File 'lib/yweather/atmosphere.rb', line 15 def pressure @pressure end |
#visibility ⇒ Object (readonly)
Returns the value of attribute visibility.
14 15 16 |
# File 'lib/yweather/atmosphere.rb', line 14 def visibility @visibility end |