Skip to content

Instantly share code, notes, and snippets.

@inopinatus
Created January 14, 2026 05:03
Show Gist options
  • Select an option

  • Save inopinatus/a495900c435918f98a00d9595b7fbecc to your computer and use it in GitHub Desktop.

Select an option

Save inopinatus/a495900c435918f98a00d9595b7fbecc to your computer and use it in GitHub Desktop.
old-school means to bypass locally overridden methods
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
@inopinatus
Copy link
Author

big disadvantage, it's terrible for the method caching.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment