Module: Trackdown
- Defined in:
- lib/trackdown.rb,
lib/trackdown/error.rb,
lib/trackdown/version.rb,
lib/trackdown/ip_locator.rb,
lib/trackdown/ip_validator.rb,
lib/trackdown/configuration.rb,
lib/trackdown/location_result.rb,
lib/trackdown/database_updater.rb,
lib/generators/trackdown/install_generator.rb
Defined Under Namespace
Modules: Generators
Classes: Configuration, DatabaseUpdater, Error, IpLocator, IpValidator, LocationResult
Constant Summary
collapse
- VERSION =
"0.1.1"
Class Attribute Summary collapse
Class Method Summary
collapse
Class Attribute Details
.configuration ⇒ Object
16
17
18
|
# File 'lib/trackdown.rb', line 16
def self.configuration
@configuration ||= Configuration.new
end
|
Class Method Details
20
21
22
|
# File 'lib/trackdown.rb', line 20
def self.configure
yield(configuration)
end
|
.database_exists? ⇒ Boolean
33
34
35
|
# File 'lib/trackdown.rb', line 33
def self.database_exists?
File.exist?(configuration.database_path)
end
|
.ensure_database_exists! ⇒ Object
37
38
39
40
41
|
# File 'lib/trackdown.rb', line 37
def self.ensure_database_exists!
unless database_exists?
raise Error, "MaxMind database not found. Please set your MaxMind keys in config/initializers/trackdown.rb as described in the `trackdown` gem README, and then run Trackdown.update_database to download the MaxMind IP geolocation database."
end
end
|
.locate(ip) ⇒ Object
24
25
26
27
|
# File 'lib/trackdown.rb', line 24
def self.locate(ip)
ensure_database_exists!
IpLocator.locate(ip)
end
|
.update_database ⇒ Object