title: Ruby: How to loop through an object that may or may not be an array?
body: <p>I have an each method that is run on some user-submitted data.</p>
  
  <p>Sometimes it will be an array, other times it won't be.</p>
  
  <p>Example submission:</p>
  
  <pre><code>&lt;numbers&gt;
      &lt;number&gt;12345&lt;/number&gt;
  &lt;/numbers&gt;
  </code></pre>
  
  <p>Another example:</p>
  
  <pre><code>&lt;numbers&gt;
      &lt;number&gt;12345&lt;/number&gt;
      &lt;number&gt;09876&lt;/number&gt;
  &lt;/numbers&gt;
  </code></pre>
  
  <p>I have been trying to do an <code>each do</code> on that, but when there is only one number I get a <code>TypeError (Symbol as array index)</code> error.</p>