Class: Tree::TreeNode
- Inherits:
-
Object
- Object
- Tree::TreeNode
- Defined in:
- lib/evoc/tree/tree_node.rb
Instance Method Summary collapse
-
#left_siblings ⇒ Object
The left siblings of the current node.
-
#right_siblings ⇒ Object
The right siblings of the current node.
Instance Method Details
#left_siblings ⇒ Object
Returns the left siblings of the current node.
18 19 20 21 22 23 24 |
# File 'lib/evoc/tree/tree_node.rb', line 18 def left_siblings if self.is_first_sibling? return [] else return [self.previous_sibling] + self.previous_sibling.left_siblings end end |
#right_siblings ⇒ Object
Returns the right siblings of the current node.
8 9 10 11 12 13 14 |
# File 'lib/evoc/tree/tree_node.rb', line 8 def right_siblings if self.is_last_sibling? return [] else return [self.next_sibling] + self.next_sibling.right_siblings end end |