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
80 81 82 83 84 85 86 |
# File 'lib/ullr/noaa.rb', line 80 def has_snow? if self.value =~ /snow/i return true else return false end end |
#high_temperature ⇒ Object
125 126 127 128 129 130 131 132 |
# File 'lib/ullr/noaa.rb', line 125 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
134 135 136 137 138 139 140 141 |
# File 'lib/ullr/noaa.rb', line 134 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
88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/ullr/noaa.rb', line 88 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
102 103 104 105 106 107 108 109 110 |
# File 'lib/ullr/noaa.rb', line 102 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
112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/ullr/noaa.rb', line 112 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 |