Class: Kenma::PreProcessor

Inherits:
NodeConverter show all
Includes:
Macro::Basic, Macro::MacroFunction, Macro::MacroPattern, Macro::UseMacro
Defined in:
lib/kenma/pre_processor.rb

Class Method Summary collapse

Methods included from Macro::MacroPattern

#node_missing

Methods included from Macro::Basic

#NODE_GASGN, #NODE_GVAR, #eval!, #node_bind!, #stringify!, #symbolify!, #unstringify!

Methods included from Macro::UseMacro

#initialize, #use_macro!

Methods inherited from NodeConverter

#convert, #initialize

Class Method Details

.compile(node, context = {}) ⇒ Object



19
20
21
# File 'lib/kenma/pre_processor.rb', line 19

def self.compile(node, context = {})
  new(context).compile(node)
end

.compile_of(body, context = {}) ⇒ Object



23
24
25
26
# File 'lib/kenma/pre_processor.rb', line 23

def self.compile_of(body, context = {})
  bind = body.binding unless context[:bind]
  compile(RubyVM::AbstractSyntaxTree.of(body), { bind: bind }.merge(context))
end