require 'fiddle'
def with_ephemeral_inclusion obj
fp = Fiddle::Pointer.new obj.__id__ * 2
sol = Fiddle::SIZEOF_LONG
orig = fp[sol * 2, 4]
obj.instance_eval &proc
fp[sol * 2, 4] = orig
end
A = Module.new
B = Module.new
with_ephemeral_inclusion Object do
include A
include B
p ancestors
end
p Object.ancestors
cmVxdWlyZSAnZmlkZGxlJwoKZGVmIHdpdGhfZXBoZW1lcmFsX2luY2x1c2lvbiBvYmoKICBmcCAgPSBGaWRkbGU6OlBvaW50ZXIubmV3IG9iai5fX2lkX18gKiAyCiAgc29sID0gRmlkZGxlOjpTSVpFT0ZfTE9ORwoKICBvcmlnID0gZnBbc29sICogMiwgNF0KICBvYmouaW5zdGFuY2VfZXZhbCAmcHJvYwogIGZwW3NvbCAqIDIsIDRdID0gb3JpZwplbmQKCkEgPSBNb2R1bGUubmV3CkIgPSBNb2R1bGUubmV3Cgp3aXRoX2VwaGVtZXJhbF9pbmNsdXNpb24gT2JqZWN0IGRvCiAgaW5jbHVkZSBBCiAgaW5jbHVkZSBCCiAgcCBhbmNlc3RvcnMKZW5kCgpwIE9iamVjdC5hbmNlc3RvcnM=