Class: CoffeeOutside::Forecast
- Inherits:
-
Object
- Object
- CoffeeOutside::Forecast
- Defined in:
- lib/coffeeoutside/weather.rb
Instance Attribute Summary collapse
-
#temperature ⇒ Object
readonly
Returns the value of attribute temperature.
Instance Method Summary collapse
-
#initialize(hash) ⇒ Forecast
constructor
A new instance of Forecast.
- #rainy? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(hash) ⇒ Forecast
Returns a new instance of Forecast.
40 41 42 43 |
# File 'lib/coffeeoutside/weather.rb', line 40 def initialize(hash) @humidity = hash[:humidity] || 0 @temperature = hash[:temperature] || 0 end |
Instance Attribute Details
#temperature ⇒ Object (readonly)
Returns the value of attribute temperature.
50 51 52 |
# File 'lib/coffeeoutside/weather.rb', line 50 def temperature @temperature end |
Instance Method Details
#rainy? ⇒ Boolean
45 46 47 48 |
# File 'lib/coffeeoutside/weather.rb', line 45 def rainy? # TODO: could also regex for "rain" or "snow" from OWM... @humidity >= HUMIDITY_LIMIT end |
#to_s ⇒ Object
52 53 54 |
# File 'lib/coffeeoutside/weather.rb', line 52 def to_s "Forecast is temp of #{@temperature} humidity #{@humidity}" end |