Method: Tree::TreeNode#initialize

Defined in:
lib/tree.rb

#initialize(name, content = nil) ⇒ TreeNode

Constructor which expects the name of the node

Name of the node is expected to be unique across the tree.

The content can be of any type, and is defaulted to nil.



105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/tree.rb', line 105

def initialize(name, content = nil)

        raise "Node name HAS to be provided" if name == nil

        @name = name
        @content = content

        self.setAsRoot!

        @childrenHash = Hash.new
        @children = []
end