title: ArgumentError: comparison of NilClass with 1 failed min_by
body: <p>I need to find out the minimum of an array without nil.</p>
  
  <pre><code>[{val: 1},{val: nil}].min_by { |v| v[:val] }
  </code></pre>
  
  <p>gets</p>
  
  <p><code>ArgumentError: comparison of NilClass with 1 failed min_by</code></p>
  
  <p>My next approach was:</p>
  
  <pre><code>[{val: 1},{val: nil}].min_by { |v| v[:val] || 0 }
  </code></pre>
  
  <p>But this returns <code>{:duration=&gt;nil}</code></p>
  
  <p>I only want to get the minimum value without the nil value - expected 1</p>