Created
October 3, 2014 17:08
-
-
Save shekibobo/bdff99785f6fd8dbd3c3 to your computer and use it in GitHub Desktop.
Tapp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Object | |
def tapp(msg = nil) | |
tap do |obj| | |
if msg.nil? | |
pp obj | |
elsif obj.respond_to?(msg) | |
pp obj.send(msg) | |
else | |
puts "#{obj} does not respond to #{msg}." | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment