Module: Rack::Async::Wrapper

Defined in:
lib/rack/async/wrapper.rb

Instance Method Summary collapse

Instance Method Details

#async_call(env) ⇒ Object



17
18
19
# File 'lib/rack/async/wrapper.rb', line 17

def async_call(env)
  call(env)
end

#call(env) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/rack/async/wrapper.rb', line 8

def call(env)
  return super unless callback = env['async.callback']
  env['async.callback'] = proc do |result|
    app.set_response_for(env, result)
    async_call(env)
  end
  catch(:async) { super } || ASYNC_RESPONSE
end

#initialize(app, *args, &block) ⇒ Object



4
5
6
# File 'lib/rack/async/wrapper.rb', line 4

def initialize(app, *args, &block)
  super(CachedResponse.new(app), *args, &block)
end