Skip to content
Snippets Groups Projects
Commit dd27e923 authored by Alex Reisner's avatar Alex Reisner
Browse files

Extract class name determination to new method.

parent 8af00bdb
No related branches found
No related tags found
No related merge requests found
......@@ -50,13 +50,16 @@ module Geocoder
if all_services.include?(name)
name = name.to_s
require "geocoder/lookups/#{name}"
klass = name.split("_").map{ |i| i[0...1].upcase + i[1..-1] }.join
Geocoder::Lookup.const_get(klass).new
Geocoder::Lookup.const_get(classify_name(name)).new
else
valids = all_services.map(&:inspect).join(", ")
raise ConfigurationError, "Please specify a valid lookup for Geocoder " +
"(#{name.inspect} is not one of: #{valids})."
end
end
def self.classify_name(filename)
filename.split("_").map{ |i| i[0...1].upcase + i[1..-1] }.join
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment