 <p>Assuming this data is in some kind of enumerable object you can do:</p> <pre><code>arrays, hashes = data.group_by(&amp;:class).values_at(Array, Hash) </code></pre> <p>However it feels wrong. Most likely you rather need to wrap each hash within its own array (so you can later to double iteration). If this is the case:</p> <pre><code>data.map! {|array_or_hash| Array.wrap(array_or_hash)} </code></pre>