Class: Rope::BasicNode
- Inherits:
-
Object
- Object
- Rope::BasicNode
- Defined in:
- lib/rope/basic_node.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#depth ⇒ Object
readonly
Depth of the tree.
-
#length ⇒ Object
readonly
Length of the underlying data in the tree and its descendants.
Instance Method Summary collapse
-
#+(other) ⇒ Object
Concatenates this tree with another tree (non-destructive to either tree).
-
#rebalance! ⇒ Object
Rebalances this tree.
-
#replace!(index, length, rhs) ⇒ Object
Swaps out the data in this node to be rhs.
-
#segment(index) ⇒ Object
Returns the Node that contains this index or nil if the index is out of bounds.
-
#to_primitive ⇒ Object
Gets the string representation of the underlying data in the tree.
Instance Attribute Details
#depth ⇒ Object (readonly)
Depth of the tree
7 8 9 |
# File 'lib/rope/basic_node.rb', line 7 def depth @depth end |
#length ⇒ Object (readonly)
Length of the underlying data in the tree and its descendants
4 5 6 |
# File 'lib/rope/basic_node.rb', line 4 def length @length end |
Instance Method Details
#+(other) ⇒ Object
Concatenates this tree with another tree (non-destructive to either tree)
11 12 13 |
# File 'lib/rope/basic_node.rb', line 11 def +(other) InteriorNode.new(self, other) end |
#rebalance! ⇒ Object
Rebalances this tree
26 27 28 |
# File 'lib/rope/basic_node.rb', line 26 def rebalance! raise NotImplementedError end |
#replace!(index, length, rhs) ⇒ Object
Swaps out the data in this node to be rhs. Must be same length
31 32 33 |
# File 'lib/rope/basic_node.rb', line 31 def replace!(index, length, rhs) raise NotImplementedError end |
#segment(index) ⇒ Object
Returns the Node that contains this index or nil if the index is out of bounds
21 22 23 |
# File 'lib/rope/basic_node.rb', line 21 def segment(index) raise NotImplementedError end |
#to_primitive ⇒ Object
Gets the string representation of the underlying data in the tree
16 17 18 |
# File 'lib/rope/basic_node.rb', line 16 def to_primitive data end |