Created
January 17, 2009 18:02
-
-
Save outoftime/48400 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 CallLogged | |
def hey | |
puts 'hey' | |
end | |
def double(i) | |
i*2 | |
end | |
public_instance_methods(false).each do |method| | |
alias_method :"#{method}_without_logging", method | |
define_method(method) do |*args| | |
puts "#{method}(#{args.inspect.gsub(/^\[|\]$/, '')})" | |
send "#{method}_without_logging", *args | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment