Module: Void
- Defined in:
- lib/void.rb
Class Method Summary collapse
- .compile(code = "") ⇒ Object
-
.render(file, context = {}) ⇒ Object
Analyze the input code and check for matching tokens.
Class Method Details
.compile(code = "") ⇒ Object
12 13 14 15 16 17 |
# File 'lib/void.rb', line 12 def compile(code = "") # Instantiate required language components @syntax = Parser.parse code pp @syntax end |
.render(file, context = {}) ⇒ Object
Analyze the input code and check for matching tokens. In case no match was found, throw an exception. In special cases, modify the token hash.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/void.rb', line 25 def render(file, context = {}) @file = file # Accept both ruby hashes and JSON files as database environments case context when Hash @context = context when String @context = JSON.parse(File.read context) end # Run all the processors compile PreProcessor.process @file end |