Skip to content

Instantly share code, notes, and snippets.

Created December 8, 2015 11:34
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/699ccac1323c5a0eac74 to your computer and use it in GitHub Desktop.
Save anonymous/699ccac1323c5a0eac74 to your computer and use it in GitHub Desktop.
require 'fiddle'
class RubyVM::InstructionSequence
load_fn_addr = Fiddle::Handle::DEFAULT['rb_iseq_load']
load_fn = Fiddle::Function.new(load_fn_addr,
[Fiddle::TYPE_VOIDP] * 3,
Fiddle::TYPE_VOIDP)
define_singleton_method(:load) do |data, parent = nil, opt = nil|
load_fn.call(Fiddle.dlwrap(data), parent, opt).to_value
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment