Module: Rack
- Defined in:
- lib/stack-service-base/mcp/rack_test_mcp_protocol.rb
Defined Under Namespace
Modules: Test
Classes: CommonLogger, Lint
Class Method Summary
collapse
Class Method Details
.define_middleware(name, &block) ⇒ Object
11
12
13
|
# File 'lib/stack-service-base/rack_helpers.rb', line 11
def Rack.define_middleware(name, &block)
RackHelpers.const_set name, Rack.middleware_klass(&block)
end
|
.middleware_klass(&block) ⇒ Object
4
5
6
7
8
9
|
# File 'lib/stack-service-base/rack_helpers.rb', line 4
def Rack.middleware_klass(&block)
Class.new do
define_method(:initialize) do |app, *opts, &block2|; @app = app; @opts = opts; @block = block2 || block end
def call(env) = @block.call env, @app, @opts
end
end
|