class Helper
Public Class Methods
degToCompass(wind_deg)
click to toggle source
Helper
function to convert degrees to wind direction
# 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)
click to toggle source
Helper
function to convert to Celsius
# File lib/helper.rb, line 11 def self.toCelsius(temp_f) ((temp_f - 32) * (5.0 / 9.0)).round(2) end