Sha256: 3e04b16e244b73e73f4a584050bccf205e7a7e5f0498ca0871427df626198a7c

Contents?: true

Size: 455 Bytes

Versions: 5

Compression:

Stored size: 455 Bytes

Contents

module RShade
  # nodoc
  class SourceNode < Tree
    def initialize(value = nil)
      super(value)
    end

    def clone_by(new_tree = SourceNode.new(nil), &block)
      if yield(self)
        new_tree.value = value
        node = SourceNode.new(nil)
        node.parent = new_tree
        new_tree << node
        new_tree = node
      end

      nodes.each do |item|
        item.clone_by(new_tree, &block)
      end
      new_tree
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rshade-0.1.6 lib/rshade/source_node.rb
rshade-0.1.5 lib/rshade/source_node.rb
rshade-0.1.4 lib/rshade/source_node.rb
rshade-0.1.3 lib/rshade/source_node.rb
rshade-0.1.2 lib/rshade/source_node.rb