Satyajeet Kanetkar

Satyajeet Kanetkar ·

If you are you doing this: def fetch_foo! foo = fetch_foo if foo.nil? raise "could not fetch foo" else foo end end Try this instead: def fetch_foo! fetch_foo.tap do |f| raise "could not fetch foo" if f.nil? end end #Ruby