Use tap to return an object after doing something with it
my_object.tap{ |my_object| my_object.do_anything_here }
=> my_object
Written by Daniel Green
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#