MRI Magic Tricks
summary
Three concrete hacks and whether they actually work: frozen core extraction uses ObjectSpace and id2ref to find MRI’s hidden rubyvm frozen_core, exposes internal methods via a gem, and successfully aliases globals, reimplements hash_from_array and backports method-returning-name behavior (but can crash if used wrongly). superclass reassignment binds module initialize_copy to a class to change its superclass — it can mutate user and builtin class hierarchies but sometimes triggers segfaults. segfault rescue injects objects into $LOADED_FEATURES whose to_str raises a custom exception and so captures a crashing dump, allowing rescue in practice.
AI-written summary · about








