@@ -69,28 +69,24 @@ def activate
69
69
after_hook = self . method ( :after_hook )
70
70
with_disabled_hook = self . method ( :with_disabled_hook )
71
71
72
- hook_method_def = Proc . new do |*args , &block |
73
- is_array_containing_empty_hash = -> ( obj ) {
74
- obj . is_a? ( Array ) && obj . length == 1 && obj [ 0 ] . is_a? ( Hash ) && obj [ 0 ] . size == 0
75
- }
76
-
77
- call_instance_method = -> {
78
- # https://github.com/applandinc/appmap-ruby/issues/153
79
- if NEW_RUBY && is_array_containing_empty_hash . ( args ) && hook_method . arity == 1
80
- if NEW_RUBY
81
- hook_method . bind_call ( self , { } , &block )
82
- else
83
- hook_method . bind ( self ) . call ( { } , &block )
84
- end
72
+ is_array_containing_empty_hash = -> ( obj ) {
73
+ obj . is_a? ( Array ) && obj . length == 1 && obj [ 0 ] . is_a? ( Hash ) && obj [ 0 ] . size == 0
74
+ }
75
+
76
+ call_instance_method = lambda do |receiver , args , &block |
77
+ # https://github.com/applandinc/appmap-ruby/issues/153
78
+ if NEW_RUBY && is_array_containing_empty_hash . ( args ) && hook_method . arity == 1
79
+ hook_method . bind_call ( receiver , { } , &block )
80
+ else
81
+ if NEW_RUBY
82
+ hook_method . bind_call ( receiver , *args , &block )
85
83
else
86
- if NEW_RUBY
87
- hook_method . bind_call ( self , *args , &block )
88
- else
89
- hook_method . bind ( self ) . call ( *args , &block )
90
- end
84
+ hook_method . bind ( receiver ) . call ( *args , &block )
91
85
end
92
- }
86
+ end
87
+ end
93
88
89
+ hook_method_def = Proc . new do |*args , &block |
94
90
# We may not have gotten the class for the method during
95
91
# initialization (e.g. for a singleton method on an embedded
96
92
# struct), so make sure we have it now.
@@ -112,7 +108,7 @@ def activate
112
108
return_value = nil
113
109
exception = nil
114
110
begin
115
- return_value = call_instance_method . call
111
+ return_value = call_instance_method . call ( self , args , & block )
116
112
rescue
117
113
exception = $ERROR_INFO
118
114
raise
0 commit comments