Repository is archived
No commit activity in last 3 years
No release in over 3 years
Expose RubyVM::FrozenCore
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.14
~> 10.0
~> 3.0
 Project Readme

RubyVM::FrozenCore

An evil gem to expose hidden class in CRuby core.

Usage

RubyVM::FrozenCore
# NameError: uninitialized constant RubyVM::FrozenCore

require 'rubyvm/frozencore'
RubyVM::FrozenCore #=> BasicObject

RubyVM::FrozenCore.methods
# => [:"core#set_method_alias",
#  :"core#set_variable_alias",
#  :"core#undef_method",
#  :"core#define_method",
#  :"core#define_singleton_method",
#  :"core#set_postexe",
#  :"core#hash_from_ary",
#  :"core#hash_merge_ptr",
#  :"core#hash_merge_kwd",
#  ...

# You can call hidden core methods with this class.
# Of course you can use Module.remove_method in normal use case. This is a useless example.
RubyVM::FrozenCore.send(:"core#undef_method", String, :prepend)

"b".prepend("a")
# NoMethodError: undefined method `prepend' for "b":String

See also

There is already a gem with the same purpose.

https://github.com/charliesome/frozen_core

But it relied on a bug which was fixed in Ruby 2.1.0. rubyvm-frozencore works with Ruby >= 2.1.0.

License

The gem is available as open source under the terms of the MIT License.