Class: Meddler::PreInterceptor
- Inherits:
-
Object
- Object
- Meddler::PreInterceptor
- Defined in:
- lib/meddler.rb
Instance Attribute Summary collapse
-
#skip_app ⇒ Object
Returns the value of attribute skip_app.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, skip_app, rule = nil) ⇒ PreInterceptor
constructor
A new instance of PreInterceptor.
Constructor Details
#initialize(app, skip_app, rule = nil) ⇒ PreInterceptor
Returns a new instance of PreInterceptor.
41 42 43 44 45 |
# File 'lib/meddler.rb', line 41 def initialize(app, skip_app, rule = nil) @app = app @skip_app = skip_app @rule = rule end |
Instance Attribute Details
#skip_app ⇒ Object
Returns the value of attribute skip_app.
39 40 41 |
# File 'lib/meddler.rb', line 39 def skip_app @skip_app end |
Instance Method Details
#call(env) ⇒ Object
47 48 49 |
# File 'lib/meddler.rb', line 47 def call(env) response = @rule.nil? || @rule.call(Rack::Request.new(env)) ? @app.call(env) : @skip_app.call(env) end |