Module: StateMachines::SyntaxValidator
- Defined in:
- lib/state_machines/syntax_validator.rb
Overview
Cross-platform syntax validation for eval strings Supports CRuby, JRuby, TruffleRuby via pluggable backends
Defined Under Namespace
Modules: RipperBackend, RubyVmBackend
Class Method Summary collapse
- 
  
    
      .backend  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Lazily pick the best backend for this platform Prefer RubyVM for performance on CRuby, fallback to Ripper for compatibility. 
- 
  
    
      .validate!(code, filename = '(eval)')  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Public API: raises SyntaxError if code is invalid. 
Class Method Details
.backend ⇒ Object
Lazily pick the best backend for this platform Prefer RubyVM for performance on CRuby, fallback to Ripper for compatibility
| 19 20 21 22 23 24 25 | # File 'lib/state_machines/syntax_validator.rb', line 19 def backend @backend ||= if RubyVmBackend.available? RubyVmBackend else RipperBackend end end | 
.validate!(code, filename = '(eval)') ⇒ Object
Public API: raises SyntaxError if code is invalid
| 10 11 12 | # File 'lib/state_machines/syntax_validator.rb', line 10 def validate!(code, filename = '(eval)') backend.validate!(code, filename) end |