Class: WrfForecast::Directions
- Inherits:
-
Object
- Object
- WrfForecast::Directions
- Defined in:
- lib/wrf_forecast/data/directions.rb
Overview
Simple data class to map the geographical directions to a string representation
Instance Attribute Summary collapse
-
#directions ⇒ Hash
readonly
private
The mapping of direction and direction name.
Instance Method Summary collapse
-
#get_direction_string(symbol) ⇒ String
encapsulating getter to retrieve the direction string to a given direction.
-
#initialize ⇒ Directions
constructor
initialization.
-
#initialize_directions ⇒ Object
private
method to initialize the mapping from direction to direction text.
Constructor Details
#initialize ⇒ Directions
initialization
9 10 11 |
# File 'lib/wrf_forecast/data/directions.rb', line 9 def initialize initialize_directions end |
Instance Attribute Details
#directions ⇒ Hash (readonly, private)
Returns the mapping of direction and direction name.
23 24 25 |
# File 'lib/wrf_forecast/data/directions.rb', line 23 def directions @directions end |
Instance Method Details
#get_direction_string(symbol) ⇒ String
encapsulating getter to retrieve the direction string to a given direction
16 17 18 |
# File 'lib/wrf_forecast/data/directions.rb', line 16 def get_direction_string(symbol) @directions[symbol] end |
#initialize_directions ⇒ Object (private)
method to initialize the mapping from direction to direction text
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/wrf_forecast/data/directions.rb', line 26 def initialize_directions @directions = Hash.new() @directions[:N] = I18n.t("direction.north") @directions[:S] = I18n.t("direction.south") @directions[:W] = I18n.t("direction.west") @directions[:E] = I18n.t("direction.east") @directions[:NW] = I18n.t("direction.northwest") @directions[:NE] = I18n.t("direction.northeast") @directions[:SW] = I18n.t("direction.southwest") @directions[:SE] = I18n.t("direction.southeast") nil end |