title: how to excute code on webrick server
body: <p>I start a <code>webrick</code> server like this:</p>
  
  <pre><code>dell@dev:/var/www/ruby$ ruby -run  -httpd. -p 5000
  </code></pre>
  
  <p>and have this code in <code>abc.rb</code>:</p>
  
  <pre><code>require 'webrick'
  
  root   = File.path '/tmp/public_html'
  server = WEBrick::HTTPServer.new :Port =&gt; 5000, :DocumentRoot =&gt; root
  
  trap 'INT' do server.shutdown end
  server.start
  
  ary = {  "0"=&gt;"fred", "1"=&gt;10, "2"=&gt;3.14, "3"=&gt;"This is a string", "4"=&gt;"last element", }
  ary.each do |key, value|
     puts  "#{key} #{value}"
  end
  </code></pre>
  
  <p>When I run this code it shows me the same code on browser</p>
  
  <pre><code>http://localhost:5000/abc.rb
  </code></pre>
  
  <p>How can I view the output this code, I have already asked this question and did not get any correct answer :(</p>
  
  <p>Is it the right code? I want to know this, where this code place </p>
  
  <pre><code>require 'webrick'
  
  root   = File.path '/tmp/public_html'
  server = WEBrick::HTTPServer.new :Port =&gt; 5000, :DocumentRoot =&gt; root
  
  trap 'INT' do server.shutdown end
  server.start
  </code></pre>
  
  <p>if any one give me step by step ans to run this code i am very thankful.. I don't understand the ans :( how to do this</p>