Module: ANTLR3::Test::NameSpace

Included in:
GrammarManager
Defined in:
lib/antlr3/test/functional.rb

Overview

module Location

Instance Method Summary collapse

Instance Method Details

#import(ruby_file) ⇒ Object

import( ruby_file ) => [ new constants, … ] Read the source code from the path given by ruby_file and evaluate it within the class body. Return new constants created in the class after the evaluation.



44
45
46
47
48
# File 'lib/antlr3/test/functional.rb', line 44

def import( ruby_file )
  constants_before = constants
  class_eval( File.read( ruby_file ), ruby_file, 1 )
  constants - constants_before
end

#import_grammar_targets(grammar) ⇒ Object



50
51
52
53
54
# File 'lib/antlr3/test/functional.rb', line 50

def import_grammar_targets( grammar )
  for file in grammar.target_files
    import( file )
  end
end