Created
January 14, 2026 05:03
-
-
Save inopinatus/a495900c435918f98a00d9595b7fbecc to your computer and use it in GitHub Desktop.
old-school means to bypass locally overridden methods
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def hook | |
| @_hook ||= yield_self do |host| | |
| Object.new.extend(self).tap do |m| | |
| m.define_singleton_method(:core, &host.method(:core)) | |
| end | |
| end | |
| end |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
big disadvantage, it's terrible for the method caching.