Class: Rack::Builder

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/flash.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#insObject (readonly)

Returns the value of attribute ins


3
4
5
# File 'lib/rack/flash.rb', line 3

def ins
  @ins
end

Instance Method Details

#leaf_appObject


23
24
25
# File 'lib/rack/flash.rb', line 23

def leaf_app
  ins.last
end

#run(app) ⇒ Object


14
15
16
17
18
19
20
21
# File 'lib/rack/flash.rb', line 14

def run(app)
  klass = app.class
  klass.instance_variable_set "@rack_builder", self
  def klass.rack_builder
    @rack_builder
  end
  @ins << app #lambda { |nothing| app }
end

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


4
5
6
7
8
9
10
11
12
# File 'lib/rack/flash.rb', line 4

def use(middleware, *args, &block)
  middleware.instance_variable_set "@rack_builder", self
  def middleware.rack_builder
    @rack_builder
  end
  @ins << lambda { |app|
    middleware.new(app, *args, &block)
  }
end