Forked from brainopia/replace_superclass_pointer_in_memory.rb
Created
November 6, 2015 12:39
-
-
Save nepalez/cfef882b3d0e522796f4 to your computer and use it in GitHub Desktop.
This file contains 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
require 'fiddle' | |
A = Class.new | |
B = Class.new | |
C = Class.new A | |
p C.superclass # => A | |
(Fiddle::Pointer[Fiddle.dlwrap C] + 16)[0, 8] = Fiddle::Pointer[Fiddle.dlwrap B].ref | |
p C.superclass # => B |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment