Skip to content
Snippets Groups Projects
Commit 7226966b authored by Fernando Morgenstern's avatar Fernando Morgenstern
Browse files

Move geoip gem check to the initialize function.

Lookups are always loaded even when they aren't used. So the geoip gem was being checked even when user wouldn't like to use the maxmind_local lookup.
parent c9dda094
No related branches found
No related tags found
No related merge requests found
require 'geocoder/lookups/base'
require 'geocoder/results/maxmind_local'
begin
require 'geoip'
rescue LoadError => e
raise 'Could not load geoip dependency. To use MaxMind Local lookup you must add geoip gem to your Gemfile or have it installed in your system.'
end
module Geocoder::Lookup
class MaxmindLocal < Base
def initialize
begin
require 'geoip'
rescue LoadError => e
raise 'Could not load geoip dependency. To use MaxMind Local lookup you must add geoip gem to your Gemfile or have it installed in your system.'
end
super
end
def name
"MaxMind Local"
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