Class: Forecast::IO::Cache::Forecast

Inherits:
Object
  • Object
show all
Defined in:
lib/forecast_io/cache/forecast.rb

Instance Method Summary collapse

Constructor Details

#initialize(cache = Store.new, generate = Generate) ⇒ Forecast

Returns a new instance of Forecast.



6
7
8
# File 'lib/forecast_io/cache/forecast.rb', line 6

def initialize cache = Store.new, generate = Generate
  @cache, @generate = cache, generate
end

Instance Method Details

#for(lat, lon, time) ⇒ Object



10
11
12
# File 'lib/forecast_io/cache/forecast.rb', line 10

def for lat, lon, time
  cached(lat, lon, time) or fetch_and_store(lat, lon, time)
end