Class: Goliath::Rack::Builder

Inherits:
Rack::Builder
  • Object
show all
Includes:
Params::Parser
Defined in:
lib/goliath/rack/builder.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Methods included from Params::Parser

#retrieve_params

Instance Attribute Details

#paramsObject

Returns the value of attribute params.



4
5
6
# File 'lib/goliath/rack/builder.rb', line 4

def params
  @params
end

Class Method Details

.build(klass, api) ⇒ Object

Builds the rack middleware chain for the given API

Parameters:

  • klass (Class)

    The API class to build the middlewares for

  • api (Object)

    The instantiated API

Returns:

  • (Object)

    The Rack middleware chain



12
13
14
15
16
17
18
19
# File 'lib/goliath/rack/builder.rb', line 12

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