lib/weather_fetcher/providers/metar/wunderground.rb in weather_fetcher-0.0.4 vs lib/weather_fetcher/providers/metar/wunderground.rb in weather_fetcher-0.0.5
- old
+ new
@@ -8,10 +8,12 @@
return u
end
def process(string)
reg = /<div class=\"textReport\">\s*METAR\s*([^<]*)<\/div>/
- string = string.scan(reg).first.first
+ _s = string.scan(reg)
+ return nil if _s.size == 0
+ string = _s.first.first
string.gsub!(/\n/, ' ')
string.gsub!(/\t/, ' ')
string.gsub!(/\s{2,}/, ' ')
string.strip
end