Class: AsyncRack::CatchAsync

Inherits:
Object
  • Object
show all
Defined in:
lib/async_rack/catch_async.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, async_response = [-1, {}, []]) ⇒ CatchAsync

Returns a new instance of CatchAsync.



6
7
8
# File 'lib/async_rack/catch_async.rb', line 6

def initialize(app, async_response = [-1, {}, []])
  @app, @async_response = app, async_response
end

Instance Method Details

#call(env) ⇒ Object



10
11
12
13
14
# File 'lib/async_rack/catch_async.rb', line 10

def call(env)
  response = @async_response
  catch(:async) { response = @app.call env }
  response
end