Created
December 5, 2014 12:57
-
-
Save mriddle/139460e5b942de5a37b2 to your computer and use it in GitHub Desktop.
Snoopy the helpful WTF? tool
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 Snoopy < BasicObject | |
def initialize(obj) | |
@obj = obj | |
end | |
def method_missing(method, *attributes, &block) | |
@obj.send(method, *attributes, &block).tap do |val| | |
@obj.send(:puts, "#{method} #{attributes} -> #{val}") | |
@obj.send(:puts, "\t#{::Kernel.caller.to_a[0..2].join("\n\t")}\n\n") | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment