Sha256: 5214d7252a5a40342b0409c496bfbdfa202fc3084d17d5b2c1d59d7b4c35a35c

Contents?: true

Size: 651 Bytes

Versions: 1

Compression:

Stored size: 651 Bytes

Contents

module TodoNext::Tree::Visitor
  class Base

    def visit(curr_node, level, parent) #nodoc#
      if curr_node.terminal?
        process_terminal_node(curr_node, level, parent)
      else
        process_non_terminal_node(curr_node, level, parent)
      end
    end

    def visit_children_of(parent, parent_level)
      parent.children.each do |node|
        visit(node, 1+parent_level, parent)
      end
    end

    # overwrite in the concrete visitor class
    def process_terminal_node(curr_node, level, parent)
    end

    # overwrite in the concrete visitor class
    def process_non_terminal_node(curr_node, level, parent)
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
todo_next-0.0.2 lib/todo_next/tree/visitor/base.rb