Sha256: 0cde70a4d37c2ba1ed39896b68bc6d643597a12bca7efc6cb00d4584ddb312c8

Contents?: true

Size: 502 Bytes

Versions: 3

Compression:

Stored size: 502 Bytes

Contents

#encoding: utf-8

module WeatherFetcher
  class Provider::Wunderground < MetarProvider

    def url_for_metar(metar_city)
      u = "http://www.wunderground.com/Aviation/index.html?query=#{metar_city.upcase}"
      return u
    end

    def process(string)
      reg = /<div class=\"textReport\">\s*METAR\s*([^<]*)<\/div>/
      string = string.scan(reg).first.first
      string.gsub!(/\n/, ' ')
      string.gsub!(/\t/, ' ')
      string.gsub!(/\s{2,}/, ' ')
      string.strip
    end

  end

end


Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
weather_fetcher-0.0.4 lib/weather_fetcher/providers/metar/wunderground.rb
weather_fetcher-0.0.3 lib/weather_fetcher/providers/metar/wunderground.rb
weather_fetcher-0.0.2 lib/weather_fetcher/providers/metar/wunderground.rb