Class: Helper
- Inherits:
-
Object
- Object
- Helper
- Defined in:
- lib/helper.rb
Direct Known Subclasses
Class Method Summary collapse
-
.degToCompass(wind_deg) ⇒ Object
Helper function to convert degrees to wind direction.
-
.toCelsius(temp_f) ⇒ Object
Helper function to convert to Celsius.
Class Method Details
.degToCompass(wind_deg) ⇒ Object
Helper function to convert degrees to wind direction
4 5 6 7 8 |
# File 'lib/helper.rb', line 4 def self.degToCompass(wind_deg) val = ((wind_deg.to_f / 22.5) + 0.5).floor direction_arr = ["N", "NNE", "NE", "ENE", "E", "ESE", "SE", "SSE", "S", "SSW", "SW", "WSW", "W", "WNW", "NW", "NNW"] return direction_arr[(val % 16)] end |
.toCelsius(temp_f) ⇒ Object
Helper function to convert to Celsius
11 12 13 |
# File 'lib/helper.rb', line 11 def self.toCelsius(temp_f) ((temp_f - 32) * (5.0 / 9.0)).round(2) end |