Skip to content

Commit

Permalink
Update ip2location_lite.rb
Browse files Browse the repository at this point in the history
  • Loading branch information
ip2location committed Sep 26, 2023
1 parent 13b5a0c commit 0e42a74
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/geocoder/lookups/ip2location_lite.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ def initialize
rescue LoadError
raise "Could not load IP2Location DB dependency. To use the IP2LocationLite lookup you must add the #{@gem_name} gem to your Gemfile or have it installed in your system."
end

@i2l = Ip2location.new.open(configuration[:file].to_s)
end
super
end
Expand All @@ -33,7 +31,8 @@ def required_api_key_parts
def results(query)
return [] unless configuration[:file]

result = @i2l.get_all(query.to_s)
i2l = Ip2location.new.open(configuration[:file].to_s)
result = i2l.get_all(query.to_s)
result.nil? ? [] : [result]
end
end
Expand Down

0 comments on commit 0e42a74

Please sign in to comment.