Module: Vernacular::BootsnapMixin

Defined in:
lib/vernacular.rb

Overview

Module that gets included into ‘Bootsnap::CompileCache::ISeq` in order to hook into the bootsnap compilation process.

Instance Method Summary collapse

Instance Method Details

#input_to_storage(contents, filepath) ⇒ Object



30
31
32
33
34
35
36
# File 'lib/vernacular.rb', line 30

def input_to_storage(contents, filepath)
  contents = ::Vernacular.modify(contents)
  iseq = RubyVM::InstructionSequence.compile(contents, filepath, filepath)
  iseq.to_binary
rescue SyntaxError
  raise ::Bootsnap::CompileCache::Uncompilable, 'syntax error'
end