Sha256: 88ac07f90bb654daedcecd7999971099818905d8e627583aad0583be5efbbc28

Contents?: true

Size: 283 Bytes

Versions: 7

Compression:

Stored size: 283 Bytes

Contents

module NYNY
  class MiddlewareChain
    def initialize middlewares, proxy
      @top = middlewares.reverse.reduce (proxy) do |prev, entry|
        klass, args, blk = entry
        klass.new prev, *args, &blk
      end
    end

    def call env
      @top.call(env)
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
nyny-2.2.1 lib/nyny/middleware_chain.rb
nyny-2.1.1 lib/nyny/middleware_chain.rb
nyny-2.1.0 lib/nyny/middleware_chain.rb
nyny-2.0.0 lib/nyny/middleware_chain.rb
nyny-1.0.2 lib/nyny/middleware_chain.rb
nyny-1.0.1 lib/nyny/middleware_chain.rb
nyny-1.0.0 lib/nyny/middleware_chain.rb