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

.country_code(query) ⇒ Object



14
15
16
# File 'lib/barometer/query/formats/weather_id.rb', line 14

def self.country_code(query)
  (query && query.size >= 2) ? _fix_country(query[0..1]) : nil
end

.regexObject



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

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