I have 2 ruby source files, for example:
A.rb
require "B"
foo
B.rb
def foo()
..
end
now I use the code to compile A to bytecode (Ruby v2.3.3):
byte_code = RubyVM::InstructionSequence.compile_file "A.rb"
File.binwrite "A.byte", byte_code.to_binary
and when I run the bytecode:
byte_code_in_binary = IO.binread "A.byte"
instruction_from_byte_code = RubyVM::InstructionSequence.load_from_binary byte_code_in_binary
instruction_from_byte_code.eval
then message was:
.... in `require': cannot load such file -- B (LoadError)
if I compile the B.rb to bytecode then how can A.byte load B.byte ? or is there another way to compile the full ruby project to bytecode and run ? does Jruby or some tools can make it happen ? thanks.