title: Ruby on Rails: Passing argument to singleton
body: <p>I have a Rails app that repeatedly talks to another Web server through a wrapper, and I'd like to stick the wrapper in a Singleton class so it's not recreated for every request.  Easy enough, I thought:</p>
  
  <pre><code>class AppWrapper &lt; Wrapper
    include Singleton
  end
  ...
  wrapper = AppWrapper.instance "url"
  </code></pre>
  
  <p>Only it doesn't work:</p>
  
  <pre><code>wrong number of arguments (0 for 1)
  /usr/lib/ruby/1.8/singleton.rb:94:in `initialize'
  /usr/lib/ruby/1.8/singleton.rb:94:in `new'
  /usr/lib/ruby/1.8/singleton.rb:94:in `instance'
  </code></pre>
  
  <p>Wrapper.initialize needs an argument, and apparently it's not getting passed through, since line 94 in question says</p>
  
  <pre><code>@__instance__ = new # look Ma, no argument
  </code></pre>
  
  <p>How do I work around this?  Redefining initialize in AppWrapper doesn't seem to help, and 
  mucking around with Wrapper to separate "set URL" from "initialize" seems suboptimal.</p>