title: Pass block passed to method to another method in Ruby
body: <p>I'm trying to write a clone of the ruby <code>keep_if</code> and <code>delete_if</code> array methods. Here is my code.</p>
  
  <pre><code>module Strain
    def keep
      self.inject([]) do |extracts, element|
        yield(element) ? extracts &lt;&lt; element : extracts 
      end
    end
  
    def discard
      self.inject([]) do |extracts, element|
        !yield(element) ? extracts &lt;&lt; element : extracts
      end
    end
  end
  
  class Array
    include Strain
  end
  </code></pre>
  
  <p>This works. But I want to do something like:</p>
  
  <pre><code>def discard
    self - self.keep &amp;block
  end
  </code></pre>
  
  <p>Desired behaviour:</p>
  
  <pre><code>[1, 2, 3].discard { |number| number &lt; 2 }
  # =&gt; [2, 3]
  </code></pre>
  
  <p>So I need to pass the block that is passed to the <code>discard</code> method, to be passed on to the <code>keep</code> method. How do I achieve this?</p>