Module: Perb::InstructionSequenceExt

Defined in:
lib/perb.rb

Overview

Extension module for RubyVM::InstructionSequence which patches the load_iseq method to use the Perb rewriter.

Instance Method Summary collapse

Instance Method Details

#load_iseq(path) ⇒ Object



31
32
33
34
35
36
37
38
39
# File 'lib/perb.rb', line 31

def load_iseq(path)
  source = Parser::Source::Buffer.new(path).read
  parser = Parser::CurrentRuby.new
  rewriter = Perb::Rewriter.new

  ast = parser.parse(source)
  source = rewriter.rewrite(source, ast)
  RubyVM::InstructionSequence.compile(source, path, path)
end