class RuboCop::AST::Node

def sibling_index

Returns:
  • (Integer, nil) - the index of the receiver node in its siblings
def sibling_index
  parent&.children&.index { |sibling| sibling.equal?(self) }
end