Skip to content

Instantly share code, notes, and snippets.

@outoftime
Created January 17, 2009 18:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save outoftime/48400 to your computer and use it in GitHub Desktop.
Save outoftime/48400 to your computer and use it in GitHub Desktop.
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