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

#initializeEmptyNode

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

#siblingObject

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

#sizeObject

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

#subtreeObject

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_hObject

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_sObject

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