Module: Rack::Geoip

Defined in:
lib/rack/geoip.rb,
lib/rack/geoip/lookup.rb,
lib/rack/geoip/version.rb

Overview

Rack Middleware for GEOIP Lookups

Rack::Geoip is intended to be a rack interface into a GeoIP database provided by MaxMind (www.maxmind.com). See the README for installation

Usage

Basic Usage

require 'rack/geoip'
use Rack::Geoip
run app

Using with Rails

Add this to your config/environment.rb

config.gem 'rack-geoip'

And then in an initializer block

config.middleware.use "Rack::Geoip",
  :db => 'data/GeoLiteCity.dat',
  :path => '/geoip/info',
  :db_lookup => :memory

Defined Under Namespace

Classes: Lookup

Constant Summary collapse

VERSION =
'2.0.2'

Class Method Summary collapse

Class Method Details

.new(backend, options = {}) ⇒ Object



34
35
36
# File 'lib/rack/geoip.rb', line 34

def self.new(backend, options = {})
  Lookup.new(backend,options)
end