title: run ruby from emacs buffer
body: <p>How can I run a ruby piece of code from a buffer, without actually saving the buffer in a file? A scenario would be to 
  a) switch to the scratch buffer
  b) M-x ruby-mode
  c) type ruby code
  d) "compile" the buffer and print results in another buffer. I don't want to save the buffer contents in a file and then "compile" that file</p>
  
  <p>UPDATE 1-9-2011
  Which are the latest versions of ruby-mode and inf-ruby and where can I get them? I use the ubuntu natty version of ruby mode and the elpa version of inf-ruby of emacs 23.2. On a clean emacs config, the following config (see underneath) fail with:</p>
  
  <pre>
  can't convert nil into String 
  from (irb):1:in `eval' 
  from (irb):1". 
  </pre>
  
  <p>Configuration is <em>just</em> the following, no other configuration directives in emacs.d:</p>
  
  <pre>
  (require 'ruby-mode)
  (load-file "Configs/.emacs.d/elpa/inf-ruby-2.1/inf-ruby.el")
  
  (autoload 'inf-ruby "inf-ruby" "Run an inferior Ruby pathrocess" t)
  (autoload 'inf-ruby-keys "inf-ruby" "" t)
  (eval-after-load 'ruby-mode
    '(add-hook 'ruby-mode-hook 'inf-ruby-keys))
  </pre>