Class: CoffeeOutside::Forecast

Inherits:
Object
  • Object
show all
Defined in:
lib/coffeeoutside/weather.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#temperatureObject (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

Returns:

  • (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_sObject



52
53
54
# File 'lib/coffeeoutside/weather.rb', line 52

def to_s
  "Forecast is temp of #{@temperature} humidity #{@humidity}"
end