Class: AsyncRack::ThrowAsync
- Inherits:
-
Object
- Object
- AsyncRack::ThrowAsync
- Defined in:
- lib/async_rack/throw_async.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, throw_on = [-1, 0]) ⇒ ThrowAsync
constructor
A new instance of ThrowAsync.
Constructor Details
#initialize(app, throw_on = [-1, 0]) ⇒ ThrowAsync
Returns a new instance of ThrowAsync.
7 8 9 |
# File 'lib/async_rack/throw_async.rb', line 7 def initialize(app, throw_on = [-1, 0]) @app, @throw_on = app, throw_on end |
Instance Method Details
#call(env) ⇒ Object
11 12 13 14 15 |
# File 'lib/async_rack/throw_async.rb', line 11 def call(env) response = @app.call env throw :async if @throw_on.include? response.first response end |