Sha256: 0a8e5af6b78099dc16f0fefef5087cd96a522c67cd4004d8630e786309473964

Contents?: true

Size: 376 Bytes

Versions: 15

Compression:

Stored size: 376 Bytes

Contents

require_relative 'callback'
module Async
  class Middleware
    def initialize(app)
      @app = app
    end

    def last_response
      callback.response
    end

    def callback
      @callback ||= Callback.new
    end

    def call(env)
      env['async.callback'] = callback

      catch(:async) do
        @app.call env
      end

      [200, {}, []]
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
sitehub-0.5.0.alpha12 spec/support/async/middleware.rb
sitehub-0.4.10 spec/support/async/middleware.rb
sitehub-0.5.0.alpha11 spec/support/async/middleware.rb
sitehub-0.5.0.alpha10 spec/support/async/middleware.rb
sitehub-0.5.0.alpha8 spec/support/async/middleware.rb
sitehub-0.5.0.alpha7 spec/support/async/middleware.rb
sitehub-0.5.0.alpha6 spec/support/async/middleware.rb
sitehub-0.5.0.alpha5 spec/support/async/middleware.rb
sitehub-0.5.0.alpha4 spec/support/async/middleware.rb
sitehub-0.5.0.alpha3 spec/support/async/middleware.rb
sitehub-0.5.0.alpha2 spec/support/async/middleware.rb
sitehub-0.4.9 spec/support/async/middleware.rb
sitehub-0.4.8 spec/support/async/middleware.rb
sitehub-0.4.7 spec/support/async/middleware.rb
sitehub-0.4.6 spec/support/async/middleware.rb