Module: Fastr::Deferrable

Included in:
Controller
Defined in:
lib/fastr/deferrable.rb

Instance Method Summary collapse

Instance Method Details

#defer_response(code, headers, &block) ⇒ Object



3
4
5
6
7
8
9
10
11
12
# File 'lib/fastr/deferrable.rb', line 3

def defer_response(code, headers, &block)
  response = DeferrableResponse.new

  EM.next_tick do
    env['async.callback'].call([code, headers, response])
    block.call(response)
  end

  [-1, {}, []].freeze
end