Class: Rux::Visitor

Inherits:
Object
  • Object
show all
Defined in:
lib/rux/visitor.rb

Direct Known Subclasses

DefaultVisitor

Instance Method Summary collapse

Instance Method Details

#visit(node) ⇒ Object



3
4
5
# File 'lib/rux/visitor.rb', line 3

def visit(node)
  node.accept(self)
end

#visit_children(node) ⇒ Object



27
28
29
30
31
# File 'lib/rux/visitor.rb', line 27

def visit_children(node)
  if node.respond_to?(:children)
    node.children.each { |child| visit(child) }
  end
end

#visit_list(node) ⇒ Object



7
8
9
# File 'lib/rux/visitor.rb', line 7

def visit_list(node)
  visit_children(node)
end

#visit_ruby(node) ⇒ Object



11
12
13
# File 'lib/rux/visitor.rb', line 11

def visit_ruby(node)
  visit_children(node)
end

#visit_string(node) ⇒ Object



15
16
17
# File 'lib/rux/visitor.rb', line 15

def visit_string(node)
  visit_children(node)
end

#visit_tag(node) ⇒ Object



19
20
21
# File 'lib/rux/visitor.rb', line 19

def visit_tag(node)
  visit_children(node)
end

#visit_text(node) ⇒ Object



23
24
25
# File 'lib/rux/visitor.rb', line 23

def visit_text(node)
  visit_children(node)
end