Technically in Ruby there's never a point in which methods are no longer added, so it's a bit hard to hook that. One potential is to use TracePoint to hook the ending of a class definition and retaining a class of "infected" classes, but that'd be slow.
Technically in Ruby there's never a point in which methods are no longer added, so it's a bit hard to hook that. One potential is to use
TracePoint
to hook the ending of a class definition and retaining a class of "infected" classes, but that'd be slow.Look for "Class End Event" in this article: medium.com/@baweaver/exploring-tra...
EDIT - ...though now I'm curious if one could use such things to freeze a class from modifications.