A Ruby gem for debugging by tracking object method calls, traces, and state mutations with minimal code.
ObjectTracer is a Ruby gem that tracks objects and records their activities, including method calls, traces, and state mutations. It helps developers debug Ruby applications by providing detailed insights into object behavior with minimal code changes, outputting results in a readable format.
Ruby developers, particularly those working on Rails applications or complex Ruby projects who need to debug object interactions and state changes efficiently.
Developers choose ObjectTracer because it offers a simple, one-line debugging approach that reduces code intrusion, provides comprehensive tracking of object events, and integrates seamlessly with Ruby method chains and Rails environments.
ObjectTracer tracks objects and records their activities
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Enables debugging with just one line of code like `print_calls(object)`, reducing the need for extensive code changes, aligning with its philosophy of minimal intrusion.
Tracks method calls, traces, and state mutations in a readable format, providing full visibility into object behavior, as shown in the detailed output examples with arguments and return values.
Allows inserting debug helpers into method chains with `with_print_calls`, avoiding the need to break apart code, as demonstrated for debugging `SomeService.new(params).perform`.
Supports filtering calls or traces using `.with` blocks for targeted debugging, such as only printing methods matching a regex, as shown in the advanced usages.
The gem is officially deprecated in favor of ruby/tracer, meaning no future updates, bug fixes, or long-term support, making it risky for new projects.
The README explicitly warns that ObjectTracer can significantly harm performance, especially in larger applications, due to its use of TracePoint and hijacking methods.
Requires enabling `hijack_attr_methods: true` to track attr-generated methods, which is a hack with O(n) overhead and potential safety concerns, as admitted in the options.