Skip to content

Commit 8143f14

Browse files
committed
fix: Hook the first class or module in the ancestor chain
1 parent 6f2e871 commit 8143f14

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

lib/appmap/hook/method.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,7 @@ def activate
9494
end
9595
hook_method_def = hook_method_def.ruby2_keywords if hook_method_def.respond_to?(:ruby2_keywords)
9696

97-
m = Module.new
98-
m.define_method_with_arity(hook_method.name, hook_method.arity, hook_method_def)
99-
hook_class.prepend m
97+
hook_class.ancestors.first.define_method_with_arity(hook_method.name, hook_method.arity, hook_method_def)
10098
end
10199

102100
protected

0 commit comments

Comments
 (0)