title: Ruby "return unless nil" idiom
body: <p>I've got a smelly method like:</p>
  
  <pre><code>def search_record(*args)    
    record = expensive_operation_1(foo)
    return record unless record.nil?
  
    record = expensive_operation_2(foo, bar)
    return record unless record.nil?
  
    record = expensive_operation_3(baz)
    return record unless record.nil?
  
    record = expensive_operation_4(foo, baz)
    return record unless record.nil?
  end
  </code></pre>
  
  <p>Is there a good ruby idiom for "return result of call unless nil"? </p>
  
  <p>Or should I just write a <code>return_unless_nil(&amp;blk)</code> method?</p>
  
  <p>(Note that args are different for each call, so I can't simply just iterate over them)</p>