Class: Astel::NodePattern::MatcherCompiler

Inherits:
Object
  • Object
show all
Defined in:
lib/astel/node_pattern/matcher_compiler.rb

Instance Method Summary collapse

Instance Method Details

#compile(pattern) ⇒ Object



6
7
8
9
10
# File 'lib/astel/node_pattern/matcher_compiler.rb', line 6

def compile(pattern)
  @variable = 0
  expression = result_expression(pattern, 'value')
  eval("->(value) { #{expression} }", binding, __FILE__, __LINE__)
end