Top Level Namespace
Defined in:
Macro Summary
-
add_method_hooks(method_name, block_def = nil, &block)
Wraps existing overloads with the supplied method body.
-
trace(method_name, callback, block_def = nil)
Runs a named method or a Proc literal before and after the original method.
-
trace(method_name, block_def = nil, &block)
Runs the hook with
__trace_phase__set to:beforeand then:after.
Macro Detail
Wraps existing overloads with the supplied method body. Use previous_def
to delegate to the original method. The wrapper exposes the same method
metadata as the block form of trace, except for __trace_phase__.
Runs a named method or a Proc literal before and after the original method.
Named methods receive the target, phase, identifier, call counter and self.
Proc literals receive the leading zero to five arguments from that list.
Runs the hook with __trace_phase__ set to :before and then :after.
A hook that calls previous_def controls delegation and runs once instead.
The hook body can access the method parameters, self,
__trace_method_name__ (String), __trace_method_identifier__ (String),
__trace_method_receiver__ (the receiver type), and
__trace_method_call_counter__ (UInt128).