Class: Take::Unit
- Inherits:
-
Object
- Object
- Take::Unit
- Defined in:
- lib/take/unit.rb,
lib/take/unit/ast.rb,
lib/take/unit/scanner.rb,
lib/take/unit/ast/node.rb,
lib/take/unit/ast/test.rb,
lib/take/unit/compiler.rb,
lib/take/unit/ast/after.rb,
lib/take/unit/ast/block.rb,
lib/take/unit/ast/group.rb,
lib/take/unit/generator.rb,
lib/take/unit/ast/before.rb,
lib/take/unit/ast/parent.rb,
lib/take/unit/ast/prefix.rb,
lib/take/unit/ast/source.rb,
lib/take/unit/predict_match.rb
Overview
A unit test. This is used to generate c files for tests.
Defined Under Namespace
Modules: AST, PredictMatch Classes: Compiler, Generator, Scanner
Class Method Summary collapse
Class Method Details
.create(file) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/take/unit.rb', line 12 def self.create(file) file = File.open(file, "r") scanner = Scanner.new(file.read) compiler = Compiler.new(file.path, scanner.scan) generator = Generator.new(compiler.compile, directory: File.dirname(file.path)).tap(&:generate) generator.write_file(file.path.gsub(/\..*\z/, ".c")) end |