class Prognosium::Dispatcher
Constants
- FORECASTS
Public Class Methods
best_forecast(options)
click to toggle source
# File lib/prognosium/dispatcher.rb, line 14 def best_forecast(options) forecasts(options).min_by { |_type, forecast| forecast.error_percent }[1] end
call(type, options)
click to toggle source
# File lib/prognosium/dispatcher.rb, line 10 def call(type, options) forecast(type).new(options) end
Private Class Methods
forecast(type)
click to toggle source
# File lib/prognosium/dispatcher.rb, line 20 def forecast(type) FORECASTS.fetch(type) { raise 'Not found forecast' } end
forecasts(options)
click to toggle source
# File lib/prognosium/dispatcher.rb, line 24 def forecasts(options) FORECASTS.map { |type, forecast| [type, forecast(type).new(options)] }.to_h end