Parent

Methods

Class Index [+]

Quicksearch

Rack::Recursive

Rack::Recursive allows applications called down the chain to include data from other applications (by using rack[...] or raise a ForwardRequest to redirect internally.

Public Class Methods

new(app) click to toggle source

(Not documented)

    # File lib/rack/recursive.rb, line 33
33:     def initialize(app)
34:       @app = app
35:     end

Public Instance Methods

call(env) click to toggle source

(Not documented)

    # File lib/rack/recursive.rb, line 37
37:     def call(env)
38:       @script_name = env["SCRIPT_NAME"]
39:       @app.call(env.merge('rack.recursive.include' => method(:include)))
40:     rescue ForwardRequest => req
41:       call(env.merge(req.env))
42:     end
include(env, path) click to toggle source

(Not documented)

    # File lib/rack/recursive.rb, line 44
44:     def include(env, path)
45:       unless path.index(@script_name) == 0 && (path[@script_name.size] == ?/ ||
46:                                                path[@script_name.size].nil?)
47:         raise ArgumentError, "can only include below #{@script_name}, not #{path}"
48:       end
49: 
50:       env = env.merge("PATH_INFO" => path, "SCRIPT_NAME" => @script_name,
51:                       "REQUEST_METHOD" => "GET",
52:                       "CONTENT_LENGTH" => "0", "CONTENT_TYPE" => "",
53:                       "rack.input" => StringIO.new(""))
54:       @app.call(env)
55:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.