Module: Rack::App::SingletonMethods::Middleware

Included in:
Rack::App::SingletonMethods
Defined in:
lib/rack/app/singleton_methods/middleware.rb

Instance Method Summary collapse

Instance Method Details

#middlewares(&block) ⇒ Object Also known as: middleware



3
4
5
6
7
8
9
10
# File 'lib/rack/app/singleton_methods/middleware.rb', line 3

def middlewares(&block)
  @middlewares ||= []
  unless block.nil?
    @middlewares << block
    router.reset
  end
  @middlewares
end

#use(*args, &block) ⇒ Object



14
15
16
# File 'lib/rack/app/singleton_methods/middleware.rb', line 14

def use(*args, &block)
  middlewares{ |b| b.use(*args, &block) }
end