title: Ruby: Object.to_a replacement
body: <p>I need to convert a passed in argument (single object or collection) to an Array. I don't know what the argument is. If it is an Array already, I want to leave it, otherwise create a one-element array from it. I'm looking to <strong>allow both <code>method(:objs =&gt; obj)</code> and <code>method(:objs =&gt; [obj1, obj2])</code></strong></p>
  
  <p>This seems to be the best way (Array#to_a returns self):</p>
  
  <pre><code>arg = arg.to_a
  </code></pre>
  
  <p>But the ruby docs say <strong><code>Object#to_a</code> will soon be obsolete</strong>. Is there convenient replacement?</p>
  
  <p>Anything more succinct than this?</p>
  
  <pre><code>arg = arg.respond_to?(:to_a) ? arg.to_a : [arg]
  </code></pre>