Class: Barometer::Query::Format::WeatherID

Inherits:
Base
  • Object
show all
Defined in:
lib/barometer/query/formats/weather_id.rb

Overview

Weather ID (specific to weather.com) eg. USGA0028

Constant Summary collapse

@@fixes_file =
File.expand_path(
File.join(File.dirname(__FILE__), 'translations', 'weather_country_codes.yml'))
@@fixes =
nil

Class Method Summary collapse

Methods inherited from Base

convert_query, is?

Class Method Details

.geo(query) ⇒ Object



15
16
17
18
19
# File 'lib/barometer/query/formats/weather_id.rb', line 15

def self.geo(query)
  if query && query.size >= 2
    { country_code: _fix_country(query[0..1]) }
  end
end

.regexObject



13
# File 'lib/barometer/query/formats/weather_id.rb', line 13

def self.regex; /(^[A-Za-z]{4}[0-9]{4}$)/; end