python的Ruby等价物';s imp.load_已编译

python的Ruby等价物';s imp.load_已编译,python,ruby,Python,Ruby,我正在寻找在以下python代码中加载编译代码的ruby实现: global tuser, temail tuser = **imp.load_compiled**('tuser', uplug) temail = **imp.load_compiled**('temail', eplug) 谢谢。使用RubyVM::说明顺序: 例如: ruby compiler.rb fibonacci.rb ruby exec.rb fibonacci.bin CRuby没有字节码保存/加载(正式)。哦

我正在寻找在以下python代码中加载编译代码的ruby实现:

global tuser, temail
tuser = **imp.load_compiled**('tuser', uplug)
temail = **imp.load_compiled**('temail', eplug)

谢谢。

使用
RubyVM::说明顺序

例如:

ruby compiler.rb fibonacci.rb
ruby exec.rb fibonacci.bin

CRuby没有字节码保存/加载(正式)。哦。我懂了。有其他选择吗?您可以使用JRuby或Rubinius(或mruby)。另见。
# compiler.rb
source_code = File.open(ARGV[0], 'r')       # load the file from arguments
compiled_code = RubyVM::InstructionSequence.compile(source_code)
binary_code = compiled_code.to_binary
binary_file = File.open(ARGV[0].split('.').first + '.bin', 'w+')
binary_file.puts binary_code
binary_file.close

# exec.rb
executable_binary_code = File.open(ARGV[0], 'r').readlines.join('')
compiled_instruction_sequence = \
  RubyVM::InstructionSequence.load_from_binary(executable_binary_code)
compiled_instruction_sequence.eval