Skip to content

Instantly share code, notes, and snippets.

@mriddle
Created December 5, 2014 12:57
Show Gist options
  • Save mriddle/139460e5b942de5a37b2 to your computer and use it in GitHub Desktop.
Save mriddle/139460e5b942de5a37b2 to your computer and use it in GitHub Desktop.
Snoopy the helpful WTF? tool
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