3 ms·
Here are two bash functions so that you can compile and execute the bytecode in the terminal: i.e. rubyc test.rb ruby-do test.rbc in .bashrc: function ruby
by singularity2001 11y ago
Here are two bash functions so that you can compile and execute the bytecode in the terminal:
i.e.
rubyc test.rb
ruby-do test.rbc
in .bashrc:
function rubyc() {
ruby -e "File.open('$1c', 'wb').write(RubyVM::InstructionSequence.compile_file('$1').to_binary)"
}
function ruby-do() {
ruby -e "RubyVM::InstructionSequence.load_from_binary(File.open('$1', 'rb').read).eval"
}