Skip to content

Commit

Permalink
fixup! Rename lib/alaveteli_geoip.rb to lib/alaveteli_geo_ip.rb
Browse files Browse the repository at this point in the history
  • Loading branch information
gbp committed Jan 8, 2025
1 parent 55ed43b commit 301346b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ def set_last_body(public_body)
end

def country_from_ip
return AlaveteliGeoIP.country_code_from_ip(user_ip) if user_ip
return AlaveteliGeoIp.country_code_from_ip(user_ip) if user_ip

AlaveteliConfiguration.iso_country_code
end
Expand Down
2 changes: 1 addition & 1 deletion config/initializers/alaveteli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
require 'public_body_csv'
require 'alaveteli_text_masker'
require 'database_collation'
require 'alaveteli_geoip'
require 'alaveteli_geo_ip'
require 'default_late_calculator'
require 'analytics_event'
require 'alaveteli_gettext/fuzzy_cleaner'
Expand Down
4 changes: 2 additions & 2 deletions lib/alaveteli_geo_ip.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
# country_code_from_ip rather than creating a
# new instance.

class AlaveteliGeoIP
class AlaveteliGeoIp
require 'maxmind/db'

attr_reader :geoip, :current_code

# Public: Get the country code for a given IP address
# Delegates to an instance configured with the geoip_database
# See AlaveteliGeoIP#country_code_from_ip for more documentation.
# See AlaveteliGeoIp#country_code_from_ip for more documentation.
def self.country_code_from_ip(ip)
instance.country_code_from_ip(ip)
end
Expand Down
6 changes: 3 additions & 3 deletions spec/lib/alaveteli_geoip_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'spec_helper'

RSpec.describe AlaveteliGeoIP do
RSpec.describe AlaveteliGeoIp do
let(:ip_address) { '127.0.0.1' }
let(:max_mind_config) { { mode: :MODE_MEMORY } }

Expand All @@ -14,7 +14,7 @@

it 'delegates to an instance of the class' do
expect(delegate).to receive(:country_code_from_ip).with(ip_address)
AlaveteliGeoIP.country_code_from_ip(ip_address)
AlaveteliGeoIp.country_code_from_ip(ip_address)
end
end

Expand All @@ -24,7 +24,7 @@
it { is_expected.to be_a(described_class) }

it 'caches the instance' do
expect(AlaveteliGeoIP.instance).to equal(AlaveteliGeoIP.instance)
expect(AlaveteliGeoIp.instance).to equal(AlaveteliGeoIp.instance)
end
end

Expand Down

0 comments on commit 301346b

Please sign in to comment.