Class: Rack::IpAddressRestriction
- Inherits:
-
Object
- Object
- Rack::IpAddressRestriction
- Defined in:
- lib/rack/ip_address_restriction.rb,
lib/rack/ip_address_restriction/version.rb
Constant Summary collapse
- VERSION =
"0.1.2"
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, options = {}) ⇒ IpAddressRestriction
constructor
A new instance of IpAddressRestriction.
Constructor Details
#initialize(app, options = {}) ⇒ IpAddressRestriction
Returns a new instance of IpAddressRestriction.
11 12 13 14 15 |
# File 'lib/rack/ip_address_restriction.rb', line 11 def initialize(app, = {}) @app = app = DEFAULT_MAPPING if .empty? @mapping = create_mapping() end |
Instance Method Details
#call(env) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/rack/ip_address_restriction.rb', line 17 def call(env) if allow?(env) @app.call(env) else [403, { 'Content-Type' => 'text/html', 'Content-Length' => '0' }, []] end end |