Class: WrfForecast::ForecastHandler
- Inherits:
-
Object
- Object
- WrfForecast::ForecastHandler
- Defined in:
- lib/wrf_forecast/forecast/forecast_handler.rb
Overview
This class maintains the data and handler classes which are needed to generate the forecast based on the given data
Instance Attribute Summary collapse
-
#json_converter ⇒ ForecastJsonConverter
readonly
private
The json converter.
-
#repository ⇒ ForecastRepository
readonly
private
The repository with the rehashed forecast data.
-
#text ⇒ ForecastText
readonly
The class creation the forecast text.
-
#threshold_handler ⇒ ThresholdHandler
readonly
private
The handler with the threshold indicators.
-
#wrf_handler ⇒ WrfHandler
readonly
private
The wrf handler with the input data.
Instance Method Summary collapse
-
#generate_hourly_json_output ⇒ String
method to generate a json representing the hourly values of forecast data.
-
#generate_text_json_output ⇒ String
method to generate a json representation of the forecast data.
-
#get_warnings ⇒ Hash
method to return the created warnings.
-
#initialize(wrf_handler) ⇒ ForecastHandler
constructor
initialization.
Constructor Details
#initialize(wrf_handler) ⇒ ForecastHandler
initialization
17 18 19 20 21 22 23 |
# File 'lib/wrf_forecast/forecast/forecast_handler.rb', line 17 def initialize(wrf_handler) @repository = WrfForecast::ForecastRepository.new(wrf_handler) @threshold_handler = WrfForecast::Threshold::ThresholdHandler.new(@repository) @wrf_handler = wrf_handler = wrf_handler.data_repository. @text = WrfForecast::ForecastText.new(, @repository, @threshold_handler) end |
Instance Attribute Details
#json_converter ⇒ ForecastJsonConverter (readonly, private)
Returns the json converter.
50 51 52 |
# File 'lib/wrf_forecast/forecast/forecast_handler.rb', line 50 def json_converter @json_converter end |
#repository ⇒ ForecastRepository (readonly, private)
Returns the repository with the rehashed forecast data.
52 53 54 |
# File 'lib/wrf_forecast/forecast/forecast_handler.rb', line 52 def repository @repository end |
#text ⇒ ForecastText (readonly)
Returns the class creation the forecast text.
13 14 15 |
# File 'lib/wrf_forecast/forecast/forecast_handler.rb', line 13 def text @text end |
#threshold_handler ⇒ ThresholdHandler (readonly, private)
Returns the handler with the threshold indicators.
54 55 56 |
# File 'lib/wrf_forecast/forecast/forecast_handler.rb', line 54 def threshold_handler @threshold_handler end |
#wrf_handler ⇒ WrfHandler (readonly, private)
Returns the wrf handler with the input data.
56 57 58 |
# File 'lib/wrf_forecast/forecast/forecast_handler.rb', line 56 def wrf_handler @wrf_handler end |
Instance Method Details
#generate_hourly_json_output ⇒ String
method to generate a json representing the hourly values of forecast data
35 36 37 38 39 |
# File 'lib/wrf_forecast/forecast/forecast_handler.rb', line 35 def generate_hourly_json_output @json_converter = WrfForecast::JsonConverter::HourlyForecastJsonConverter. new(@wrf_handler, @repository, @threshold_handler.warnings) @json_converter.convert end |
#generate_text_json_output ⇒ String
method to generate a json representation of the forecast data
27 28 29 30 31 |
# File 'lib/wrf_forecast/forecast/forecast_handler.rb', line 27 def generate_text_json_output @json_converter = WrfForecast::JsonConverter::TextForecastJsonConverter. new(@wrf_handler.data_repository, @repository, @threshold_handler.warnings) @json_converter.convert end |
#get_warnings ⇒ Hash
method to return the created warnings
43 44 45 |
# File 'lib/wrf_forecast/forecast/forecast_handler.rb', line 43 def get_warnings threshold_handler.warnings end |