title: Is there a similar solution as Array#wrap for hashes?
body: <p>I use <code>Array.wrap(x)</code> all the time in order to ensure that Array methods actually exist on an object before calling them.</p>
  
  <p><strong>What is the best way to similarly ensure a Hash?</strong></p>
  
  <p>Example:</p>
  
  <pre><code>def ensure_hash(x)
    # TODO: this is what I'm looking for
  end
  values = [nil,1,[],{},'',:a,1.0]
  values.all?{|x| ensure_hash(x).respond_to?(:keys) } # true
  </code></pre>