Class: Ullr::NOAA::Text
- Inherits:
-
Object
- Object
- Ullr::NOAA::Text
- Includes:
- HappyMapper
- Defined in:
- lib/ullr/noaa.rb
Instance Method Summary collapse
- #has_snow? ⇒ Boolean
- #high_temperature ⇒ Object
- #low_temperature ⇒ Object
- #snow_estimate ⇒ Object
- #wind_direction ⇒ Object
- #wind_speeds ⇒ Object
Instance Method Details
#has_snow? ⇒ Boolean
84 85 86 87 88 89 90 |
# File 'lib/ullr/noaa.rb', line 84 def has_snow? if self.value =~ /snow/i return true else return false end end |
#high_temperature ⇒ Object
129 130 131 132 133 134 135 136 |
# File 'lib/ullr/noaa.rb', line 129 def high_temperature high = '' high_temp = self.value.scan(/high near (0|[1-9]\d*)/) if !high_temp.empty? high = high_temp.first[0] end return high end |
#low_temperature ⇒ Object
138 139 140 141 142 143 144 145 |
# File 'lib/ullr/noaa.rb', line 138 def low_temperature low = '' low_temp = self.value.scan(/low around (0|[1-9]\d*)/) if !low_temp.empty? low = low_temp.first[0] end return low end |
#snow_estimate ⇒ Object
92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/ullr/noaa.rb', line 92 def snow_estimate rng = ['0','0'] range = self.value.scan(/snow accumulation of (0|[1-9]\d*) to (0|[1-9]\d*)/) one = self.value.scan(/around an inch possible/) if !one.empty? rng = ['0','1'] elsif !range.empty? rng = range.first elsif self.has_snow? rng = ['0','1'] end return rng end |
#wind_direction ⇒ Object
106 107 108 109 110 111 112 113 114 |
# File 'lib/ullr/noaa.rb', line 106 def wind_direction direction = self.value.scan(/ (\w*) wind [around|between]/i) if !direction.empty? direction = direction.first[0].downcase else direction = '' end return direction end |
#wind_speeds ⇒ Object
116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/ullr/noaa.rb', line 116 def wind_speeds rng = ['',''] range = self.value.scan(/ wind between (0|[1-9]\d*) and (0|[1-9]\d*)/i) one = self.value.scan(/ wind around (0|[1-9]\d*)/i) if !one.empty? speed = one.first[0] rng = [speed,speed] elsif !range.empty? rng = range.first end return rng end |