Class: YahooWeather::Units
- Inherits:
-
Object
- Object
- YahooWeather::Units
- Defined in:
- lib/yahoo-weather/units.rb
Overview
Describes the units of measure with which weather information is provided.
Constant Summary collapse
- FAHRENHEIT =
'f'
- CELSIUS =
'c'
Instance Attribute Summary collapse
-
#distance ⇒ Object
readonly
the units in which distance is measured, e.g.
-
#pressure ⇒ Object
readonly
the units in which pressure is measured, e.g.
-
#speed ⇒ Object
readonly
the units in which speed is measured, e.g.
-
#temperature ⇒ Object
readonly
the units in which temperature is measured, e.g.
Instance Method Summary collapse
-
#initialize(payload) ⇒ Units
constructor
A new instance of Units.
Constructor Details
#initialize(payload) ⇒ Units
Returns a new instance of Units.
18 19 20 21 22 23 |
# File 'lib/yahoo-weather/units.rb', line 18 def initialize (payload) @temperature = payload['temperature'] @distance = payload['distance'] @pressure = payload['pressure'] @speed = payload['speed'] end |
Instance Attribute Details
#distance ⇒ Object (readonly)
the units in which distance is measured, e.g. mi
for miles
.
10 11 12 |
# File 'lib/yahoo-weather/units.rb', line 10 def distance @distance end |
#pressure ⇒ Object (readonly)
the units in which pressure is measured, e.g. in
for inches
.
13 14 15 |
# File 'lib/yahoo-weather/units.rb', line 13 def pressure @pressure end |
#speed ⇒ Object (readonly)
the units in which speed is measured, e.g. mph
for miles per hour
.
16 17 18 |
# File 'lib/yahoo-weather/units.rb', line 16 def speed @speed end |
#temperature ⇒ Object (readonly)
the units in which temperature is measured, e.g. F
for Fahrenheit
or C
for Celsius
.
7 8 9 |
# File 'lib/yahoo-weather/units.rb', line 7 def temperature @temperature end |