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

Merge branch 'master' of git://github.com/gxbe/geocoder into pr/588

parents 2203be05 3d8927b9
No related branches found
No related tags found
No related merge requests found
......@@ -14,6 +14,7 @@ group :development, :test do
platforms :jruby do
gem 'jruby-openssl'
gem 'jgeoip'
end
platforms :rbx do
......
......@@ -6,11 +6,10 @@ module Geocoder::Lookup
def initialize
begin
require 'geoip'
require (RUBY_PLATFORM == 'java' ? 'jgeoip' : '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
......@@ -32,9 +31,7 @@ module Geocoder::Lookup
"Geocoder.configure(:maxmind_local => {:database => ...}), "
)
end
result = GeoIP.new(configuration[:database]).city(query.to_s)
result = (RUBY_PLATFORM == "java" ? JGeoIP.new(configuration[:database]).city(query.to_s) : GeoIP.new(configuration[:database]).city(query.to_s))
result.nil? ? [] : [result.to_hash]
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