Skip to content
This repository has been archived by the owner on May 4, 2024. It is now read-only.

Hijack attr methods with hijack_attr_methods option #45

Merged
merged 3 commits into from
Jun 13, 2020

Conversation

st0012
Copy link
Owner

@st0012 st0012 commented Jun 12, 2020

Because TracePoint doesn't track methods generated by attr_* helpers (see this issue for more info), we need to redefine those methods with the normal method definition.

This hack is disabled for most of the trackers by default, as the side-effect remains unclear. But mutation related helpers like tap_mutation! or print_mutations.

Because TracePoint doesn't support tracking attribute reader/writer
methods (which is a bug), those method calls are currently undetectable.

However, in most cases, we should still be able to track them by overriding
the generated methods with normal method definition. But since this
mutates the object's interfaces directly, it can still cause unexpected
issues. So the behavior needs to be activated explicitly with the
`hijack_attr_methods` option.
@st0012 st0012 added the Feature label Jun 12, 2020
@st0012 st0012 added this to the v0.5.3 milestone Jun 12, 2020
@st0012 st0012 self-assigned this Jun 12, 2020
@st0012 st0012 merged commit d2ba03b into master Jun 13, 2020
@st0012 st0012 deleted the hijack_attr_methods branch June 13, 2020 04:35
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant