Sha256: 9330606236fc15c67c58b58c9c3c4f3dc19696fcd752c4059b0c09df2c0eadc2

Contents?: true

Size: 587 Bytes

Versions: 9

Compression:

Stored size: 587 Bytes

Contents

module Goliath
  module Rack
    class Builder < ::Rack::Builder
      attr_accessor :params
      include Params::Parser

      # Builds the rack middleware chain for the given API
      #
      # @param klass [Class] The API class to build the middlewares for
      # @param api [Object] The instantiated API
      # @return [Object] The Rack middleware chain
      def self.build(klass, api)
        Builder.app do
          klass.middlewares.each do |mw_klass, args, blk|
            use(mw_klass, *args, &blk)
          end
          run api
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
goliath-1.0.7 lib/goliath/rack/builder.rb
goliath-1.0.6 lib/goliath/rack/builder.rb
goliath-1.0.5 lib/goliath/rack/builder.rb
goliath-1.0.4 lib/goliath/rack/builder.rb
goliath-1.0.3 lib/goliath/rack/builder.rb
goliath-1.0.2 lib/goliath/rack/builder.rb
goliath-1.0.1 lib/goliath/rack/builder.rb
goliath-1.0.0 lib/goliath/rack/builder.rb
goliath-1.0.0.beta.1 lib/goliath/rack/builder.rb