Class: LiabilityProof::Tree::InternalNode
- Inherits:
-
Struct
- Object
- Struct
- LiabilityProof::Tree::InternalNode
- Includes:
- Node
- Defined in:
- lib/liability-proof/tree/internal_node.rb
Instance Attribute Summary collapse
-
#hash ⇒ Object
Returns the value of attribute hash.
-
#left ⇒ Object
Returns the value of attribute left.
-
#right ⇒ Object
Returns the value of attribute right.
-
#sum ⇒ Object
Returns the value of attribute sum.
Instance Method Summary collapse
-
#initialize(left, right) ⇒ InternalNode
constructor
A new instance of InternalNode.
Methods included from Node
#as_json, #as_user_json, #decimal_to_digits, #sum_string
Constructor Details
#initialize(left, right) ⇒ InternalNode
Returns a new instance of InternalNode.
7 8 9 10 11 12 |
# File 'lib/liability-proof/tree/internal_node.rb', line 7 def initialize(left, right) super(left, right) self.sum = left.sum + right.sum self.hash = generate_hash end |
Instance Attribute Details
#hash ⇒ Object
Returns the value of attribute hash
4 5 6 |
# File 'lib/liability-proof/tree/internal_node.rb', line 4 def hash @hash end |
#left ⇒ Object
Returns the value of attribute left
4 5 6 |
# File 'lib/liability-proof/tree/internal_node.rb', line 4 def left @left end |
#right ⇒ Object
Returns the value of attribute right
4 5 6 |
# File 'lib/liability-proof/tree/internal_node.rb', line 4 def right @right end |
#sum ⇒ Object
Returns the value of attribute sum
4 5 6 |
# File 'lib/liability-proof/tree/internal_node.rb', line 4 def sum @sum end |