Class: Middleware::Builder

Inherits:
Object
  • Object
show all
Defined in:
lib/monkey_patch/builder.rb

Instance Method Summary collapse

Instance Method Details

#use(middleware, *args, **kwargs, &block) ⇒ Object



3
4
5
6
7
8
9
10
11
12
# File 'lib/monkey_patch/builder.rb', line 3

def use(middleware, *args, **kwargs, &block)
  if middleware.kind_of?(Builder)
    # Merge in the other builder's stack into our own
    self.stack.concat(middleware.stack)
  else
    self.stack << [middleware, args, kwargs, block]
  end

  self
end