Module: Finitio::Syntax::Node::ClassHelpers

Defined in:
lib/finitio/syntax/node.rb

Instance Method Summary collapse

Instance Method Details

#capture(*names) ⇒ Object



32
33
34
35
36
37
38
# File 'lib/finitio/syntax/node.rb', line 32

def capture(*names)
  names.each do |name|
    define_method(name) do
      captures[name].first
    end
  end
end

#capture_str(*names) ⇒ Object



40
41
42
43
44
45
46
47
# File 'lib/finitio/syntax/node.rb', line 40

def capture_str(*names)
  names.each do |name|
    define_method(name) do
      x = captures[name].first
      x && x.to_s
    end
  end
end