Class: Weather::Units
- Inherits:
-
Object
- Object
- Weather::Units
- Defined in:
- lib/weather-api/units.rb
Constant Summary collapse
- FAHRENHEIT =
'f'
- CELSIUS =
'c'
Instance Attribute Summary collapse
-
#distance ⇒ Object
readonly
the unit in which distance is measured e.g.
-
#pressure ⇒ Object
readonly
the unit in which pressure is measured e.g in for inches, and cm for centimeters.
-
#speed ⇒ Object
readonly
the unit in which speed is measured e.g.
-
#temperature ⇒ Object
readonly
the unit 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.
22 23 24 25 26 27 |
# File 'lib/weather-api/units.rb', line 22 def initialize(payload) @temperature = payload[:temperature].strip @distance = payload[:distance].strip @pressure = payload[:pressure].strip @speed = payload[:speed].strip end |
Instance Attribute Details
#distance ⇒ Object (readonly)
the unit in which distance is measured e.g. mi for miles, and km for kilometers
12 13 14 |
# File 'lib/weather-api/units.rb', line 12 def distance @distance end |
#pressure ⇒ Object (readonly)
the unit in which pressure is measured e.g in for inches, and cm for centimeters
16 17 18 |
# File 'lib/weather-api/units.rb', line 16 def pressure @pressure end |
#speed ⇒ Object (readonly)
the unit in which speed is measured e.g. mph for miles per hour, and kph for kilometers per hour
20 21 22 |
# File 'lib/weather-api/units.rb', line 20 def speed @speed end |
#temperature ⇒ Object (readonly)
the unit in which temperature is measured e.g. F for Fahrenheit, and C for Celsius
8 9 10 |
# File 'lib/weather-api/units.rb', line 8 def temperature @temperature end |