Sha256: bf093f789e2b510fcfb0baddbf2999cb03b9bf2ef0aae7815b493cb30175498c

Contents?: true

Size: 385 Bytes

Versions: 1

Compression:

Stored size: 385 Bytes

Contents

require 'treevisitor/tree_node_visitor.rb'

#
# It call a block when visit a tree_node or leaf_node
#
class BlockTreeNodeVisitor < TreeNodeVisitor

  def initialize( &action )
    @block = action
  end

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

  def exit_tree_node( treeNode )
  end

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

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gf-treevisitor-0.0.10 lib/treevisitor/visitors/block_tree_node_visitor.rb