Class: StrongRoutes::Allow
- Inherits:
-
Object
- Object
- StrongRoutes::Allow
- Defined in:
- lib/strong_routes/allow.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, options = {}) ⇒ Allow
constructor
A new instance of Allow.
Constructor Details
#initialize(app, options = {}) ⇒ Allow
Returns a new instance of Allow.
3 4 5 6 |
# File 'lib/strong_routes/allow.rb', line 3 def initialize(app, = {}) @app = app @options = end |
Instance Method Details
#call(env) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/strong_routes/allow.rb', line 8 def call(env) return @app.call(env) unless enabled? request = ::Rack::Request.new(env) if allowed?(request) @app.call(env) else [ 404, { "Content-Type" => "text/html", "Content-Length" => config..length.to_s }, [ config. ] ] end end |