Parent

Class Index [+]

Quicksearch

Rack::Cascade

Rack::Cascade tries an request on several apps, and returns the first response that is not 404 (or in a list of configurable status codes).

Attributes

apps[R]

(Not documented)

Public Class Methods

new(apps, catch=404) click to toggle source

(Not documented)

    # File lib/rack/cascade.rb, line 9
 9:     def initialize(apps, catch=404)
10:       @apps = apps
11:       @catch = [*catch]
12:     end

Public Instance Methods

<<(app) click to toggle source

Alias for add

add(app) click to toggle source

(Not documented)

    # File lib/rack/cascade.rb, line 26
26:     def add app
27:       @apps << app
28:     end
Also aliased as: <<
call(env) click to toggle source

(Not documented)

    # File lib/rack/cascade.rb, line 14
14:     def call(env)
15:       status = headers = body = nil
16:       raise ArgumentError, "empty cascade"  if @apps.empty?
17:       @apps.each { |app|
18:         begin
19:           status, headers, body = app.call(env)
20:           break  unless @catch.include?(status.to_i)
21:         end
22:       }
23:       [status, headers, body]
24:     end
include?(app) click to toggle source

(Not documented)

    # File lib/rack/cascade.rb, line 30
30:     def include? app
31:       @apps.include? app
32:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.