Skip to content

Instantly share code, notes, and snippets.

@benhoskings
Created October 7, 2009 07:22
Show Gist options
  • Save benhoskings/203849 to your computer and use it in GitHub Desktop.
Save benhoskings/203849 to your computer and use it in GitHub Desktop.
class Object
def returning obj
yield obj
obj
end
def tap
returning(self) { yield self }
end
def tapp
tap { puts "#{File.basename caller[4]}: #{self.inspect}" }
end
end
@sj26
Copy link

sj26 commented Feb 18, 2014

Love this little snippet, use it all the time. <3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment