Sha256: 987bc696410c0100b69b99f689155d0222ee5f4e34661c78640f3bc75b0dd9a2

Contents?: true

Size: 371 Bytes

Versions: 13

Compression:

Stored size: 371 Bytes

Contents

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

    def initialize( &action )
      @block = action
    end

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

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

  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
tree.rb-0.3.13 lib/tree_rb/visitors/block_tree_node_visitor.rb
tree.rb-0.3.12 lib/tree_rb/visitors/block_tree_node_visitor.rb
tree.rb-0.3.11 lib/tree_rb/visitors/block_tree_node_visitor.rb
tree.rb-0.3.10 lib/tree_rb/visitors/block_tree_node_visitor.rb
tree.rb-0.3.9 lib/tree_rb/visitors/block_tree_node_visitor.rb
tree.rb-0.3.8 lib/tree_rb/visitors/block_tree_node_visitor.rb
tree.rb-0.3.7 lib/tree_rb/visitors/block_tree_node_visitor.rb
tree.rb-0.3.6 lib/tree_rb/visitors/block_tree_node_visitor.rb
tree.rb-0.3.5 lib/tree_rb/visitors/block_tree_node_visitor.rb
tree.rb-0.3.4 lib/tree_rb/visitors/block_tree_node_visitor.rb
tree.rb-0.3.3 lib/tree_rb/visitors/block_tree_node_visitor.rb
tree.rb-0.3.2 lib/tree_rb/visitors/block_tree_node_visitor.rb
tree.rb-0.3.1 lib/tree_rb/visitors/block_tree_node_visitor.rb