X7ROOT File Manager
Current Path:
/opt/alt/ruby18/lib64/ruby/gems/1.8/doc/rack-1.6.1/rdoc/classes/Rack
opt
/
alt
/
ruby18
/
lib64
/
ruby
/
gems
/
1.8
/
doc
/
rack-1.6.1
/
rdoc
/
classes
/
Rack
/
ðŸ“
..
ðŸ“
Auth
📄
Auth.html
(3.58 KB)
📄
BodyProxy.html
(6 KB)
ðŸ“
BodyProxy.src
📄
Builder.html
(10.71 KB)
ðŸ“
Builder.src
📄
Cascade.html
(6.01 KB)
ðŸ“
Cascade.src
ðŸ“
Chunked
📄
Chunked.html
(4.76 KB)
ðŸ“
Chunked.src
📄
CommonLogger.html
(5.25 KB)
ðŸ“
CommonLogger.src
📄
ConditionalGet.html
(4.42 KB)
ðŸ“
ConditionalGet.src
📄
Config.html
(3.81 KB)
ðŸ“
Config.src
📄
ContentLength.html
(3.92 KB)
ðŸ“
ContentLength.src
📄
ContentType.html
(4.13 KB)
ðŸ“
ContentType.src
ðŸ“
Deflater
📄
Deflater.html
(4.8 KB)
ðŸ“
Deflater.src
📄
Directory.html
(11.22 KB)
ðŸ“
Directory.src
📄
ETag.html
(4.81 KB)
ðŸ“
ETag.src
📄
File.html
(7.61 KB)
ðŸ“
File.src
📄
ForwardRequest.html
(3.89 KB)
ðŸ“
ForwardRequest.src
ðŸ“
Handler
📄
Handler.html
(8.26 KB)
ðŸ“
Handler.src
📄
Head.html
(3.65 KB)
ðŸ“
Head.src
📄
Lint.html
(3.15 KB)
ðŸ“
Lint.src
📄
Lobster.html
(3.32 KB)
📄
Lock.html
(4.1 KB)
ðŸ“
Lock.src
📄
Logger.html
(3.66 KB)
ðŸ“
Logger.src
📄
MethodOverride.html
(5.23 KB)
ðŸ“
MethodOverride.src
📄
Mime.html
(47.92 KB)
ðŸ“
Mime.src
ðŸ“
MockRequest
📄
MockRequest.html
(10.57 KB)
ðŸ“
MockRequest.src
📄
MockResponse.html
(6.16 KB)
ðŸ“
MockResponse.src
ðŸ“
Multipart
📄
Multipart.html
(7.44 KB)
ðŸ“
Multipart.src
📄
NullLogger.html
(16.26 KB)
ðŸ“
NullLogger.src
📄
Recursive.html
(4.97 KB)
ðŸ“
Recursive.src
ðŸ“
Reloader
📄
Reloader.html
(5.52 KB)
ðŸ“
Reloader.src
📄
Request.html
(40.37 KB)
ðŸ“
Request.src
ðŸ“
Response
📄
Response.html
(12.57 KB)
ðŸ“
Response.src
ðŸ“
RewindableInput
📄
RewindableInput.html
(6.93 KB)
ðŸ“
RewindableInput.src
📄
Runtime.html
(4.26 KB)
ðŸ“
Runtime.src
📄
Sendfile.html
(7.83 KB)
ðŸ“
Sendfile.src
ðŸ“
Server
📄
Server.html
(11 KB)
ðŸ“
Server.src
ðŸ“
Session
📄
Session.html
(3.1 KB)
📄
ShowExceptions.html
(6 KB)
ðŸ“
ShowExceptions.src
📄
ShowStatus.html
(3.93 KB)
ðŸ“
ShowStatus.src
📄
Static.html
(8.86 KB)
ðŸ“
Static.src
📄
TempfileReaper.html
(4.03 KB)
ðŸ“
TempfileReaper.src
📄
URLMap.html
(5.27 KB)
ðŸ“
URLMap.src
ðŸ“
Utils
📄
Utils.html
(7.09 KB)
ðŸ“
Utils.src
Editing: Builder.html
<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Class: Rack::Builder</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta http-equiv="Content-Script-Type" content="text/javascript" /> <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" /> <script type="text/javascript"> // <![CDATA[ function popupCode( url ) { window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400") } function toggleCode( id ) { if ( document.getElementById ) elem = document.getElementById( id ); else if ( document.all ) elem = eval( "document.all." + id ); else return false; elemStyle = elem.style; if ( elemStyle.display != "block" ) { elemStyle.display = "block" } else { elemStyle.display = "none" } return true; } // Make codeblocks hidden by default document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" ) // ]]> </script> </head> <body> <div id="classHeader"> <table class="header-table"> <tr class="top-aligned-row"> <td><strong>Class</strong></td> <td class="class-name-in-header">Rack::Builder</td> </tr> <tr class="top-aligned-row"> <td><strong>In:</strong></td> <td> <a href="../../files/lib/rack/builder_rb.html"> lib/rack/builder.rb </a> <br /> </td> </tr> <tr class="top-aligned-row"> <td><strong>Parent:</strong></td> <td> Object </td> </tr> </table> </div> <!-- banner header --> <div id="bodyContent"> <div id="contextContent"> <div id="description"> <p> <a href="Builder.html">Rack::Builder</a> implements a small DSL to iteratively construct <a href="../Rack.html">Rack</a> applications. </p> <p> Example: </p> <pre> require 'rack/lobster' app = Rack::Builder.new do use Rack::CommonLogger use Rack::ShowExceptions map "/lobster" do use Rack::Lint run Rack::Lobster.new end end run app </pre> <p> Or </p> <pre> app = Rack::Builder.app do use Rack::CommonLogger run lambda { |env| [200, {'Content-Type' => 'text/plain'}, ['OK']] } end run app </pre> <p> <tt><a href="Builder.html#M000390">use</a></tt> adds middleware to the stack, <tt><a href="Builder.html#M000391">run</a></tt> dispatches to an application. You can <a href="Builder.html#M000390">use</a> <tt><a href="Builder.html#M000393">map</a></tt> to construct a <a href="URLMap.html">Rack::URLMap</a> in a convenient way. </p> </div> </div> <div id="method-list"> <h3 class="section-bar">Methods</h3> <div class="name-list"> <a href="#M000389">app</a> <a href="#M000395">call</a> <a href="#M000393">map</a> <a href="#M000388">new</a> <a href="#M000387">new_from_string</a> <a href="#M000386">parse_file</a> <a href="#M000391">run</a> <a href="#M000394">to_app</a> <a href="#M000390">use</a> <a href="#M000392">warmup</a> </div> </div> </div> <!-- if includes --> <div id="section"> <!-- if method_list --> <div id="methods"> <h3 class="section-bar">Public Class methods</h3> <div id="method-M000389" class="method-detail"> <a name="M000389"></a> <div class="method-heading"> <a href="Builder.src/M000389.html" target="Code" class="method-signature" onclick="popupCode('Builder.src/M000389.html');return false;"> <span class="method-name">app</span><span class="method-args">(default_app = nil, &block)</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000388" class="method-detail"> <a name="M000388"></a> <div class="method-heading"> <a href="Builder.src/M000388.html" target="Code" class="method-signature" onclick="popupCode('Builder.src/M000388.html');return false;"> <span class="method-name">new</span><span class="method-args">(default_app = nil,&block)</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000387" class="method-detail"> <a name="M000387"></a> <div class="method-heading"> <a href="Builder.src/M000387.html" target="Code" class="method-signature" onclick="popupCode('Builder.src/M000387.html');return false;"> <span class="method-name">new_from_string</span><span class="method-args">(builder_script, file="(rackup)")</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000386" class="method-detail"> <a name="M000386"></a> <div class="method-heading"> <a href="Builder.src/M000386.html" target="Code" class="method-signature" onclick="popupCode('Builder.src/M000386.html');return false;"> <span class="method-name">parse_file</span><span class="method-args">(config, opts = Server::Options.new)</span> </a> </div> <div class="method-description"> </div> </div> <h3 class="section-bar">Public Instance methods</h3> <div id="method-M000395" class="method-detail"> <a name="M000395"></a> <div class="method-heading"> <a href="Builder.src/M000395.html" target="Code" class="method-signature" onclick="popupCode('Builder.src/M000395.html');return false;"> <span class="method-name">call</span><span class="method-args">(env)</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000393" class="method-detail"> <a name="M000393"></a> <div class="method-heading"> <a href="Builder.src/M000393.html" target="Code" class="method-signature" onclick="popupCode('Builder.src/M000393.html');return false;"> <span class="method-name">map</span><span class="method-args">(path, &block)</span> </a> </div> <div class="method-description"> <p> Creates a route within the application. </p> <pre> Rack::Builder.app do map '/' do run Heartbeat end end </pre> <p> The <tt><a href="Builder.html#M000390">use</a></tt> method can also be used here to specify middleware to <a href="Builder.html#M000391">run</a> under a specific path: </p> <pre> Rack::Builder.app do map '/' do use Middleware run Heartbeat end end </pre> <p> This example includes a piece of middleware which will <a href="Builder.html#M000391">run</a> before requests hit <tt>Heartbeat</tt>. </p> </div> </div> <div id="method-M000391" class="method-detail"> <a name="M000391"></a> <div class="method-heading"> <a href="Builder.src/M000391.html" target="Code" class="method-signature" onclick="popupCode('Builder.src/M000391.html');return false;"> <span class="method-name">run</span><span class="method-args">(app)</span> </a> </div> <div class="method-description"> <p> Takes an argument that is an object that responds to <a href="Builder.html#M000395">call</a> and returns a <a href="../Rack.html">Rack</a> response. The simplest form of this is a lambda object: </p> <pre> run lambda { |env| [200, { "Content-Type" => "text/plain" }, ["OK"]] } </pre> <p> However this could also be a class: </p> <pre> class Heartbeat def self.call(env) [200, { "Content-Type" => "text/plain" }, ["OK"]] end end run Heartbeat </pre> </div> </div> <div id="method-M000394" class="method-detail"> <a name="M000394"></a> <div class="method-heading"> <a href="Builder.src/M000394.html" target="Code" class="method-signature" onclick="popupCode('Builder.src/M000394.html');return false;"> <span class="method-name">to_app</span><span class="method-args">()</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000390" class="method-detail"> <a name="M000390"></a> <div class="method-heading"> <a href="Builder.src/M000390.html" target="Code" class="method-signature" onclick="popupCode('Builder.src/M000390.html');return false;"> <span class="method-name">use</span><span class="method-args">(middleware, *args, &block)</span> </a> </div> <div class="method-description"> <p> Specifies middleware to <a href="Builder.html#M000390">use</a> in a stack. </p> <pre> class Middleware def initialize(app) @app = app end def call(env) env["rack.some_header"] = "setting an example" @app.call(env) end end use Middleware run lambda { |env| [200, { "Content-Type" => "text/plain" }, ["OK"]] } </pre> <p> All requests through to this application will first be processed by the middleware class. The <tt><a href="Builder.html#M000395">call</a></tt> method in this example sets an additional environment key which then can be referenced in the application if required. </p> </div> </div> <div id="method-M000392" class="method-detail"> <a name="M000392"></a> <div class="method-heading"> <a href="Builder.src/M000392.html" target="Code" class="method-signature" onclick="popupCode('Builder.src/M000392.html');return false;"> <span class="method-name">warmup</span><span class="method-args">(prc=nil, &block)</span> </a> </div> <div class="method-description"> <p> Takes a lambda or block that is used to warm-up the application. </p> <pre> warmup do |app| client = Rack::MockRequest.new(app) client.get('/') end use SomeMiddleware run MyApp </pre> </div> </div> </div> </div> <div id="validator-badges"> <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p> </div> </body> </html>
Upload File
Create Folder