lib/barometer/formats/format.rb in barometer-0.7.3 vs lib/barometer/formats/format.rb in barometer-0.8.0
- old
+ new
@@ -16,18 +16,18 @@
# stubs
#
def self.regex; raise NotImplementedError; end
def self.format; raise NotImplementedError; end
-
+
# defaults
#
def self.to(query=nil,country=nil); nil; end
def self.country_code(query=nil); nil; end
def self.convertable_formats; []; end
def self.convert_query(text); text; end
-
+
# is the query of this format?
#
def self.is?(query=nil)
raise ArgumentError unless query.is_a?(String)
return !(query =~ self.regex).nil?
@@ -44,21 +44,21 @@
#
def self.is_a_query?(object=nil)
return false unless object
object.is_a?(Barometer::Query)
end
-
+
private
-
+
# fix the country code
#
# weather.com uses non-standard two letter country codes that
# hinder the ability to determine the country or fetch geo_data.
# correct these "mistakes"
#
def self._fix_country(country_code)
@@fixes ||= YAML.load_file(@@fixes_file)
@@fixes[country_code.upcase.to_s] || country_code
end
-
+
end
-end
\ No newline at end of file
+end