Class: Rack::Rgeoip::Lookup
- Inherits:
-
Object
- Object
- Rack::Rgeoip::Lookup
- Defined in:
- lib/rack/rgeoip.rb
Constant Summary collapse
- DEFAULT =
{ :db => '/usr/share/GeoIP/GeoIP.dat' }
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, options = {}) ⇒ Lookup
constructor
A new instance of Lookup.
- #lookup(env) ⇒ Object
Constructor Details
Instance Method Details
#call(env) ⇒ Object
17 18 19 |
# File 'lib/rack/rgeoip.rb', line 17 def call(env) @app.call(lookup env) end |
#lookup(env) ⇒ Object
21 22 23 24 25 |
# File 'lib/rack/rgeoip.rb', line 21 def lookup(env) env.tap do env['rack.geoip'] = @rgeoip.country(Rack::Request.new(env).ip) end end |