ok

Mini Shell

Direktori : /opt/cpanel/ea-ruby27/root/usr/share/gems/doc/rack-2.2.8/rdoc/Rack/Server/
Upload File :
Current File : //opt/cpanel/ea-ruby27/root/usr/share/gems/doc/rack-2.2.8/rdoc/Rack/Server/Options.html

<!DOCTYPE html>

<html>
<head>
<meta charset="UTF-8">

<title>class Rack::Server::Options - rack-2.2.8 Documentation</title>

<script type="text/javascript">
  var rdoc_rel_prefix = "../../";
  var index_rel_prefix = "../../";
</script>

<script src="../../js/navigation.js" defer></script>
<script src="../../js/search.js" defer></script>
<script src="../../js/search_index.js" defer></script>
<script src="../../js/searcher.js" defer></script>
<script src="../../js/darkfish.js" defer></script>

<link href="../../css/fonts.css" rel="stylesheet">
<link href="../../css/rdoc.css" rel="stylesheet">




<body id="top" role="document" class="class">
<nav role="navigation">
  <div id="project-navigation">
    <div id="home-section" role="region" title="Quick navigation" class="nav-section">
  <h2>
    <a href="../../index.html" rel="home">Home</a>
  </h2>

  <div id="table-of-contents-navigation">
    <a href="../../table_of_contents.html#pages">Pages</a>
    <a href="../../table_of_contents.html#classes">Classes</a>
    <a href="../../table_of_contents.html#methods">Methods</a>
  </div>
</div>

    <div id="search-section" role="search" class="project-section initially-hidden">
  <form action="#" method="get" accept-charset="utf-8">
    <div id="search-field-wrapper">
      <input id="search-field" role="combobox" aria-label="Search"
             aria-autocomplete="list" aria-controls="search-results"
             type="text" name="search" placeholder="Search" spellcheck="false"
             title="Type to search, Up and Down to navigate, Enter to load">
    </div>

    <ul id="search-results" aria-label="Search Results"
        aria-busy="false" aria-expanded="false"
        aria-atomic="false" class="initially-hidden"></ul>
  </form>
</div>

  </div>

  

  <div id="class-metadata">
    
    <div id="parent-class-section" class="nav-section">
  <h3>Parent</h3>

  
  <p class="link">Object
  
</div>

    
    
    <!-- Method Quickref -->
<div id="method-list-section" class="nav-section">
  <h3>Methods</h3>

  <ul class="link-list" role="directory">
    
    <li ><a href="#method-i-handler_opts">#handler_opts</a>
    
    <li ><a href="#method-i-parse-21">#parse!</a>
    
  </ul>
</div>

  </div>
</nav>

<main role="main" aria-labelledby="class-Rack::Server::Options">
  <h1 id="class-Rack::Server::Options" class="class">
    class Rack::Server::Options
  </h1>

  <section class="description">
    
  </section>

  
  <section id="5Buntitled-5D" class="documentation-section">
    

    

    

    

    
     <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
       <header>
         <h3>Public Instance Methods</h3>
       </header>

    
      <div id="method-i-handler_opts" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">handler_opts</span><span
            class="method-args">(options)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          
          
          

          
          <div class="method-source-code" id="handler_opts-source">
            <pre><span class="ruby-comment"># File lib/rack/server.rb, line 127</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">handler_opts</span>(<span class="ruby-identifier">options</span>)
  <span class="ruby-keyword">begin</span>
    <span class="ruby-identifier">info</span> = []
    <span class="ruby-identifier">server</span> = <span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">Handler</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">options</span>[<span class="ruby-value">:server</span>]) <span class="ruby-operator">||</span> <span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">Handler</span>.<span class="ruby-identifier">default</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">server</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">server</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-value">:valid_options</span>)
      <span class="ruby-identifier">info</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&quot;&quot;</span>
      <span class="ruby-identifier">info</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;Server-specific options for #{server.name}:&quot;</span>

      <span class="ruby-identifier">has_options</span> = <span class="ruby-keyword">false</span>
      <span class="ruby-identifier">server</span>.<span class="ruby-identifier">valid_options</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">name</span>, <span class="ruby-identifier">description</span><span class="ruby-operator">|</span>
        <span class="ruby-keyword">next</span> <span class="ruby-keyword">if</span> <span class="ruby-regexp">/^(Host|Port)[^a-zA-Z]/</span>.<span class="ruby-identifier">match?</span>(<span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_s</span>) <span class="ruby-comment"># ignore handler&#39;s host and port options, we do our own.</span>
        <span class="ruby-identifier">info</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&quot;  -O %-21s %s&quot;</span> <span class="ruby-operator">%</span> [<span class="ruby-identifier">name</span>, <span class="ruby-identifier">description</span>]
        <span class="ruby-identifier">has_options</span> = <span class="ruby-keyword">true</span>
      <span class="ruby-keyword">end</span>
      <span class="ruby-keyword">return</span> <span class="ruby-string">&quot;&quot;</span> <span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">has_options</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">info</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">&quot;\n&quot;</span>)
  <span class="ruby-keyword">rescue</span> <span class="ruby-constant">NameError</span>, <span class="ruby-constant">LoadError</span>
    <span class="ruby-keyword">return</span> <span class="ruby-node">&quot;Warning: Could not find handler specified (#{options[:server] || &#39;default&#39;}) to determine handler-specific options&quot;</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-parse-21" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">parse!</span><span
            class="method-args">(args)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          
          
          

          
          <div class="method-source-code" id="parse-21-source">
            <pre><span class="ruby-comment"># File lib/rack/server.rb, line 12</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">parse!</span>(<span class="ruby-identifier">args</span>)
  <span class="ruby-identifier">options</span> = {}
  <span class="ruby-identifier">opt_parser</span> = <span class="ruby-constant">OptionParser</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&quot;&quot;</span>, <span class="ruby-value">24</span>, <span class="ruby-string">&#39;  &#39;</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">opts</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">banner</span> = <span class="ruby-string">&quot;Usage: rackup [ruby options] [rack options] [rackup config]&quot;</span>

    <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">separator</span> <span class="ruby-string">&quot;&quot;</span>
    <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">separator</span> <span class="ruby-string">&quot;Ruby options:&quot;</span>

    <span class="ruby-identifier">lineno</span> = <span class="ruby-value">1</span>
    <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-string">&quot;-e&quot;</span>, <span class="ruby-string">&quot;--eval LINE&quot;</span>, <span class="ruby-string">&quot;evaluate a LINE of code&quot;</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">line</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">eval</span> <span class="ruby-identifier">line</span>, <span class="ruby-constant">TOPLEVEL_BINDING</span>, <span class="ruby-string">&quot;-e&quot;</span>, <span class="ruby-identifier">lineno</span>
      <span class="ruby-identifier">lineno</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
    }

    <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-string">&quot;-d&quot;</span>, <span class="ruby-string">&quot;--debug&quot;</span>, <span class="ruby-string">&quot;set debugging flags (set $DEBUG to true)&quot;</span>) {
      <span class="ruby-identifier">options</span>[<span class="ruby-value">:debug</span>] = <span class="ruby-keyword">true</span>
    }
    <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-string">&quot;-w&quot;</span>, <span class="ruby-string">&quot;--warn&quot;</span>, <span class="ruby-string">&quot;turn warnings on for your script&quot;</span>) {
      <span class="ruby-identifier">options</span>[<span class="ruby-value">:warn</span>] = <span class="ruby-keyword">true</span>
    }
    <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-string">&quot;-q&quot;</span>, <span class="ruby-string">&quot;--quiet&quot;</span>, <span class="ruby-string">&quot;turn off logging&quot;</span>) {
      <span class="ruby-identifier">options</span>[<span class="ruby-value">:quiet</span>] = <span class="ruby-keyword">true</span>
    }

    <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-string">&quot;-I&quot;</span>, <span class="ruby-string">&quot;--include PATH&quot;</span>,
            <span class="ruby-string">&quot;specify $LOAD_PATH (may be used more than once)&quot;</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">path</span><span class="ruby-operator">|</span>
      (<span class="ruby-identifier">options</span>[<span class="ruby-value">:include</span>] <span class="ruby-operator">||=</span> []).<span class="ruby-identifier">concat</span>(<span class="ruby-identifier">path</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">&quot;:&quot;</span>))
    }

    <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-string">&quot;-r&quot;</span>, <span class="ruby-string">&quot;--require LIBRARY&quot;</span>,
            <span class="ruby-string">&quot;require the library, before executing your script&quot;</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">library</span><span class="ruby-operator">|</span>
      (<span class="ruby-identifier">options</span>[<span class="ruby-value">:require</span>] <span class="ruby-operator">||=</span> []) <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">library</span>
    }

    <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">separator</span> <span class="ruby-string">&quot;&quot;</span>
    <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">separator</span> <span class="ruby-string">&quot;Rack options:&quot;</span>
    <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-string">&quot;-b&quot;</span>, <span class="ruby-string">&quot;--builder BUILDER_LINE&quot;</span>, <span class="ruby-string">&quot;evaluate a BUILDER_LINE of code as a builder script&quot;</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">line</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">options</span>[<span class="ruby-value">:builder</span>] = <span class="ruby-identifier">line</span>
    }

    <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-string">&quot;-s&quot;</span>, <span class="ruby-string">&quot;--server SERVER&quot;</span>, <span class="ruby-string">&quot;serve using SERVER (thin/puma/webrick)&quot;</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">s</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">options</span>[<span class="ruby-value">:server</span>] = <span class="ruby-identifier">s</span>
    }

    <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-string">&quot;-o&quot;</span>, <span class="ruby-string">&quot;--host HOST&quot;</span>, <span class="ruby-string">&quot;listen on HOST (default: localhost)&quot;</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">host</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">options</span>[<span class="ruby-value">:Host</span>] = <span class="ruby-identifier">host</span>
    }

    <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-string">&quot;-p&quot;</span>, <span class="ruby-string">&quot;--port PORT&quot;</span>, <span class="ruby-string">&quot;use PORT (default: 9292)&quot;</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">port</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">options</span>[<span class="ruby-value">:Port</span>] = <span class="ruby-identifier">port</span>
    }

    <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-string">&quot;-O&quot;</span>, <span class="ruby-string">&quot;--option NAME[=VALUE]&quot;</span>, <span class="ruby-node">&quot;pass VALUE to the server as option NAME. If no VALUE, sets it to true. Run &#39;#{$0} -s SERVER -h&#39; to get a list of options for SERVER&quot;</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">name</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">name</span>, <span class="ruby-identifier">value</span> = <span class="ruby-identifier">name</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">&#39;=&#39;</span>, <span class="ruby-value">2</span>)
      <span class="ruby-identifier">value</span> = <span class="ruby-keyword">true</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">nil?</span>
      <span class="ruby-identifier">options</span>[<span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_sym</span>] = <span class="ruby-identifier">value</span>
    }

    <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-string">&quot;-E&quot;</span>, <span class="ruby-string">&quot;--env ENVIRONMENT&quot;</span>, <span class="ruby-string">&quot;use ENVIRONMENT for defaults (default: development)&quot;</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">e</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">options</span>[<span class="ruby-value">:environment</span>] = <span class="ruby-identifier">e</span>
    }

    <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-string">&quot;-D&quot;</span>, <span class="ruby-string">&quot;--daemonize&quot;</span>, <span class="ruby-string">&quot;run daemonized in the background&quot;</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">d</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">options</span>[<span class="ruby-value">:daemonize</span>] = <span class="ruby-identifier">d</span> <span class="ruby-operator">?</span> <span class="ruby-keyword">true</span> <span class="ruby-operator">:</span> <span class="ruby-keyword">false</span>
    }

    <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-string">&quot;-P&quot;</span>, <span class="ruby-string">&quot;--pid FILE&quot;</span>, <span class="ruby-string">&quot;file to store PID&quot;</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">options</span>[<span class="ruby-value">:pid</span>] = <span class="ruby-operator">::</span><span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-identifier">f</span>)
    }

    <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">separator</span> <span class="ruby-string">&quot;&quot;</span>
    <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">separator</span> <span class="ruby-string">&quot;Profiling options:&quot;</span>

    <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-string">&quot;--heap HEAPFILE&quot;</span>, <span class="ruby-string">&quot;Build the application, then dump the heap to HEAPFILE&quot;</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">e</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">options</span>[<span class="ruby-value">:heapfile</span>] = <span class="ruby-identifier">e</span>
    <span class="ruby-keyword">end</span>

    <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-string">&quot;--profile PROFILE&quot;</span>, <span class="ruby-string">&quot;Dump CPU or Memory profile to PROFILE (defaults to a tempfile)&quot;</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">e</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">options</span>[<span class="ruby-value">:profile_file</span>] = <span class="ruby-identifier">e</span>
    <span class="ruby-keyword">end</span>

    <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-string">&quot;--profile-mode MODE&quot;</span>, <span class="ruby-string">&quot;Profile mode (cpu|wall|object)&quot;</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">e</span><span class="ruby-operator">|</span>
      { <span class="ruby-value">cpu:</span> <span class="ruby-keyword">true</span>, <span class="ruby-value">wall:</span> <span class="ruby-keyword">true</span>, <span class="ruby-value">object:</span> <span class="ruby-keyword">true</span> }.<span class="ruby-identifier">fetch</span>(<span class="ruby-identifier">e</span>.<span class="ruby-identifier">to_sym</span>) <span class="ruby-keyword">do</span>
        <span class="ruby-identifier">raise</span> <span class="ruby-constant">OptionParser</span><span class="ruby-operator">::</span><span class="ruby-constant">InvalidOption</span>, <span class="ruby-node">&quot;unknown profile mode: #{e}&quot;</span>
      <span class="ruby-keyword">end</span>
      <span class="ruby-identifier">options</span>[<span class="ruby-value">:profile_mode</span>] = <span class="ruby-identifier">e</span>.<span class="ruby-identifier">to_sym</span>
    <span class="ruby-keyword">end</span>

    <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">separator</span> <span class="ruby-string">&quot;&quot;</span>
    <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">separator</span> <span class="ruby-string">&quot;Common options:&quot;</span>

    <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on_tail</span>(<span class="ruby-string">&quot;-h&quot;</span>, <span class="ruby-string">&quot;-?&quot;</span>, <span class="ruby-string">&quot;--help&quot;</span>, <span class="ruby-string">&quot;Show this message&quot;</span>) <span class="ruby-keyword">do</span>
      <span class="ruby-identifier">puts</span> <span class="ruby-identifier">opts</span>
      <span class="ruby-identifier">puts</span> <span class="ruby-identifier">handler_opts</span>(<span class="ruby-identifier">options</span>)

      <span class="ruby-identifier">exit</span>
    <span class="ruby-keyword">end</span>

    <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on_tail</span>(<span class="ruby-string">&quot;--version&quot;</span>, <span class="ruby-string">&quot;Show version&quot;</span>) <span class="ruby-keyword">do</span>
      <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;Rack #{Rack.version} (Release: #{Rack.release})&quot;</span>
      <span class="ruby-identifier">exit</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">begin</span>
    <span class="ruby-identifier">opt_parser</span>.<span class="ruby-identifier">parse!</span> <span class="ruby-identifier">args</span>
  <span class="ruby-keyword">rescue</span> <span class="ruby-constant">OptionParser</span><span class="ruby-operator">::</span><span class="ruby-constant">InvalidOption</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">e</span>
    <span class="ruby-identifier">warn</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">message</span>
    <span class="ruby-identifier">abort</span> <span class="ruby-identifier">opt_parser</span>.<span class="ruby-identifier">to_s</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">options</span>[<span class="ruby-value">:config</span>] = <span class="ruby-identifier">args</span>.<span class="ruby-identifier">last</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">last</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span><span class="ruby-identifier">args</span>.<span class="ruby-identifier">last</span>.<span class="ruby-identifier">empty?</span>
  <span class="ruby-identifier">options</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
    </section>
  
  </section>

</main>


<footer id="validator-badges" role="contentinfo">
  <p><a href="https://validator.w3.org/check/referer">Validate</a>
  <p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.2.1.1.
  <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
</footer>


Zerion Mini Shell 1.0