Class: Node

Inherits:
Object
  • Object
show all
Defined in:
lib/bst/node.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(content) ⇒ Node

Returns a new instance of Node.



6
7
8
9
10
11
12
13
14
# File 'lib/bst/node.rb', line 6

def initialize(content)
	if content.class == Node
		self.content = content.content
	else
		self.content = content
	end
	self.left_node = nil
	self.right_node = nil
end

Instance Attribute Details

#contentObject

Returns the value of attribute content.



4
5
6
# File 'lib/bst/node.rb', line 4

def content
  @content
end

#left_nodeObject

Returns the value of attribute left_node.



2
3
4
# File 'lib/bst/node.rb', line 2

def left_node
  @left_node
end

#right_nodeObject

Returns the value of attribute right_node.



3
4
5
# File 'lib/bst/node.rb', line 3

def right_node
  @right_node
end