title: Idiomatic Ruby filter for nil-or-empty?
body: <p>I'm looking for a more idiomatic way to filter out nil-or-empty elements of an array.</p>
  
  <p>I have many methods of the form:</p>
  
  <pre class="lang-rb prettyprint-override"><code>def joined
      [some_method, some_other_method].compact.reject(&amp;:empty?).join(' - ')
  end
  </code></pre>
  
  <p>This will take the result of <code>some_method</code> and <code>some_other_method</code> and return only the one(s) that are both non-nil (<code>compact</code> is essentially equivalent to <code>reject(&amp;:nil?)</code>) and non-empty.</p>
  
  <p>Is there anything in Array or Enumerable that gets the same thing in one shot?</p>