Class: Tree::TreeNode

Inherits:
Object
  • Object
show all
Defined in:
lib/evoc/tree/tree_node.rb

Instance Method Summary collapse

Instance Method Details

#left_siblingsObject

Returns the left siblings of the current node.

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_siblingsObject

Returns the right siblings of the current node.

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