Class: Monty::Watch
- Inherits:
-
Object
- Object
- Monty::Watch
- Defined in:
- lib/monty/watch.rb
Instance Method Summary collapse
-
#_call(env) ⇒ Object
Authorize request.
-
#call(env) ⇒ Object
Rack required method.
-
#initialize(app) ⇒ Watch
constructor
A new instance of Watch.
Constructor Details
#initialize(app) ⇒ Watch
Returns a new instance of Watch.
5 6 7 |
# File 'lib/monty/watch.rb', line 5 def initialize(app) @app = app end |
Instance Method Details
#_call(env) ⇒ Object
Authorize request. Redirect if access is denied.
15 16 17 18 19 20 21 22 23 |
# File 'lib/monty/watch.rb', line 15 def _call(env) delivery = Monty::Delivery.new(env) unless delivery.allowed? return [302, redirect_headers(env), []] end @app.call(env) end |
#call(env) ⇒ Object
Rack required method. For thread safety, dup self and execute _call
10 11 12 |
# File 'lib/monty/watch.rb', line 10 def call(env) dup._call(env) end |