lib/appmap/hook/method.rb in appmap-0.72.3 vs lib/appmap/hook/method.rb in appmap-0.72.4
- old
+ new
@@ -97,10 +97,17 @@
end
end
end
hook_method_def = hook_method_def.ruby2_keywords if hook_method_def.respond_to?(:ruby2_keywords)
- hook_class.ancestors.first.define_method_with_arity(hook_method.name, hook_method.arity, hook_method_def)
+ hook_method_parameters = hook_method.parameters.dup.freeze
+ hook_class.ancestors.first.tap do |cls|
+ cls.define_method_with_arity(hook_method.name, hook_method.arity, hook_method_def)
+ redefined_method = cls.instance_method(hook_method.name)
+ redefined_method.singleton_class.module_eval do
+ define_method(:parameters) { hook_method_parameters }
+ end
+ end
end
protected
def before_hook(receiver, defined_class, args)