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).

Constants

NotFound

Attributes

apps[R]

Public Class Methods

new(apps, catch=404) click to toggle source
    # File lib/rack/cascade.rb, line 11
11:     def initialize(apps, catch=404)
12:       @apps = []; @has_app = {}
13:       apps.each { |app| add app }
14: 
15:       @catch = {}
16:       [*catch].each { |status| @catch[status] = true }
17:     end

Public Instance Methods

<<(app) click to toggle source
Alias for: add
add(app) click to toggle source
    # File lib/rack/cascade.rb, line 30
30:     def add app
31:       @has_app[app] = true
32:       @apps << app
33:     end
Also aliased as: <<
call(env) click to toggle source
    # File lib/rack/cascade.rb, line 19
19:     def call(env)
20:       result = NotFound
21: 
22:       @apps.each do |app|
23:         result = app.call(env)
24:         break unless @catch.include?(result[0].to_i)
25:       end
26: 
27:       result
28:     end
include?(app) click to toggle source
    # File lib/rack/cascade.rb, line 35
35:     def include? app
36:       @has_app.include? app
37:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.