Module: StateMachines::SyntaxValidator::RubyVmBackend

Defined in:
lib/state_machines/syntax_validator.rb

Overview

MRI backend using RubyVM::InstructionSequence

Class Method Summary collapse

Class Method Details

.available?Boolean

Returns:



28
29
30
# File 'lib/state_machines/syntax_validator.rb', line 28

def available?
  RUBY_ENGINE == 'ruby'
end

.validate!(code, filename) ⇒ Object



33
34
35
36
37
# File 'lib/state_machines/syntax_validator.rb', line 33

def validate!(code, filename)
  # compile will raise a SyntaxError on bad syntax
  RubyVM::InstructionSequence.compile(code, filename)
  true
end