lib/graticule/geocoder.rb in aub-graticule-0.2.11 vs lib/graticule/geocoder.rb in aub-graticule-0.3.0
- old
+ new
@@ -6,16 +6,17 @@
# geocoder = Graticule.service(:google).new "api_key"
#
# See the documentation for your specific geocoder for more information
#
def self.service(name)
- Geocoder.const_get name.to_s.camelize
+ clazz_name = name.to_s.gsub(/_(.)/) { $1.upcase }.gsub(/^(.)/) { $1.upcase }
+ Geocoder.const_get clazz_name
end
# Base error class
class Error < RuntimeError; end
class CredentialsError < Error; end
# Raised when you try to locate an invalid address.
class AddressError < Error; end
-end
\ No newline at end of file
+end