Class: Rack::GeoIPCountry::Mapping
- Inherits:
-
Object
- Object
- Rack::GeoIPCountry::Mapping
- Defined in:
- lib/rack/geoipcountry.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, options = {}) ⇒ Mapping
constructor
A new instance of Mapping.
Constructor Details
#initialize(app, options = {}) ⇒ Mapping
Returns a new instance of Mapping.
48 49 50 51 |
# File 'lib/rack/geoipcountry.rb', line 48 def initialize(app, = {}) @app, @prefix = app, /^#{.delete(:prefix)}/ @geoip_country = GeoIPCountry.new(app, ) end |
Instance Method Details
#call(env) ⇒ Object
53 54 55 56 57 58 59 |
# File 'lib/rack/geoipcountry.rb', line 53 def call(env) if env['PATH_INFO'] =~ @prefix @geoip_country.call(env) else @app.call(env) end end |