Rack::Recursive allows applications called down the chain to include data from other applications (by using rack[...] or raise a ForwardRequest to redirect internally.
# File lib/rack/recursive.rb, line 41 41: def _call(env) 42: @script_name = env["SCRIPT_NAME"] 43: @app.call(env.merge('rack.recursive.include' => method(:include))) 44: rescue ForwardRequest => req 45: call(env.merge(req.env)) 46: end
# File lib/rack/recursive.rb, line 37 37: def call(env) 38: dup._call(env) 39: end
# File lib/rack/recursive.rb, line 48 48: def include(env, path) 49: unless path.index(@script_name) == 0 && (path[@script_name.size] == // || 50: path[@script_name.size].nil?) 51: raise ArgumentError, "can only include below #{@script_name}, not #{path}" 52: end 53: 54: env = env.merge("PATH_INFO" => path, "SCRIPT_NAME" => @script_name, 55: "REQUEST_METHOD" => "GET", 56: "CONTENT_LENGTH" => "0", "CONTENT_TYPE" => "", 57: "rack.input" => StringIO.new("")) 58: @app.call(env) 59: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.