Sha256: eca93c430d08f46a5355ee4144c975369698ff08e9db092b6f71cb27ef7898f2

Contents?: true

Size: 386 Bytes

Versions: 1

Compression:

Stored size: 386 Bytes

Contents

# -*- coding: utf-8 -*-
module TreeVisitor
  #
  # It calls a block when visit a tree_node or leaf_node
  #
  class BlockTreeNodeVisitor < BasicTreeNodeVisitor

    def initialize( &action )
      @block = action
    end

    def enter_tree_node( tree_node )
      @block.call( tree_node )
    end

    def visit_leaf_node( leaf_node )
      @block.call( leaf_node )
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
treevisitor-0.1.6 lib/treevisitor/visitors/block_tree_node_visitor.rb