Class: MerkleTree::Node::EmptyNode Private

Inherits:
MerkleTree::Node show all
Defined in:
lib/merkle_tree/node.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

An empty node used as placeholder

Constant Summary

Constants inherited from MerkleTree::Node

EMPTY, UNDEFINED

Instance Attribute Summary

Attributes inherited from MerkleTree::Node

#height, #left, #left_index, #right, #right_index, #value

Instance Method Summary collapse

Methods inherited from MerkleTree::Node

#<=>, build, #child, #include?, #leaf?, #update

Constructor Details

#initialize ⇒ EmptyNode

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of EmptyNode.



107
108
109
110
111
112
113
114
# File 'lib/merkle_tree/node.rb', line 107

def initialize
  @value  = ""
  @height = 0
  @left   = UNDEFINED
  @right  = UNDEFINED
  @left_index = UNDEFINED
  @right_index = UNDEFINED
end

Instance Method Details

#sibling ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



120
121
122
# File 'lib/merkle_tree/node.rb', line 120

def sibling(*)
  []
end

#size ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



116
117
118
# File 'lib/merkle_tree/node.rb', line 116

def size
  0
end

#subtree ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



124
125
126
# File 'lib/merkle_tree/node.rb', line 124

def subtree(*)
  {}
end

#to_h ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



130
131
132
# File 'lib/merkle_tree/node.rb', line 130

def to_h
  {}
end

#to_s ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



128
# File 'lib/merkle_tree/node.rb', line 128

def to_s; end