Re:Responsible Monkeypatching in Ruby
by eloisius on Friday August 27, 2021 @01:07AM
(#28324483)
Not sure why the author chose not to, but personally I’ve avoided use of refinements because of the weird, stateful way that it changes the implementation of a class. It’s too confusing to scan the code quickly and know whether a particular class has a refinement activated in a particular scope. Ideally don’t monkey patch things, wrap them in your own class that decorates a stdlib class. If you can’t do that, my personal preference is to have the monkey patched class be consistently monkey patched on all scopes.
[ Parent
| on HN ]
There are no comments on this comment yet.