Skip to content

Instantly share code, notes, and snippets.

@jasonroelofs
Created October 15, 2009 14:50
Show Gist options
  • Save jasonroelofs/210999 to your computer and use it in GitHub Desktop.
Save jasonroelofs/210999 to your computer and use it in GitHub Desktop.
# Normal
def method
ret_val = "something"
do_this_thing if ret_val == "something"
ret_val
end
# Or with #tap
def method
ret_val = "something"
ret_val.tap {|v| do_this_thing if v } # still returns ret_val
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment