Class: Forecast::IO::Cache::Generate
- Inherits:
-
Object
- Object
- Forecast::IO::Cache::Generate
- Defined in:
- lib/forecast_io/cache/generate.rb
Class Method Summary collapse
Instance Method Summary collapse
- #forecasts ⇒ Object
-
#initialize(lat, lon, time, cache, api = ::ForecastIO) ⇒ Generate
constructor
A new instance of Generate.
Constructor Details
#initialize(lat, lon, time, cache, api = ::ForecastIO) ⇒ Generate
Returns a new instance of Generate.
12 13 14 |
# File 'lib/forecast_io/cache/generate.rb', line 12 def initialize lat, lon, time, cache, api = ::ForecastIO @lat, @lon, @time, @cache, @api = lat, lon, time, cache, api end |
Class Method Details
.for(lat, lon, time, cache) ⇒ Object
8 9 10 |
# File 'lib/forecast_io/cache/generate.rb', line 8 def self.for lat, lon, time, cache new(lat, lon, time, cache).forecasts.first end |
Instance Method Details
#forecasts ⇒ Object
16 17 18 19 20 |
# File 'lib/forecast_io/cache/generate.rb', line 16 def forecasts ([current] + hourly).map do |forecast| @cache.store generate forecast end end |