title: How do I extract a sub-hash from a hash?
body: <p>I have a hash:</p>
  
  <pre><code>h1 = {:a =&gt; :A, :b =&gt; :B, :c =&gt; :C, :d =&gt; :D}
  </code></pre>
  
  <p>What is the best way to extract a sub-hash like this?</p>
  
  <pre><code>h1.extract_subhash(:b, :d, :e, :f) # =&gt; {:b =&gt; :B, :d =&gt; :D}
  h1 #=&gt; {:a =&gt; :A, :c =&gt; :C}
  </code></pre>