Class: RailsRouteChecker::Parsers::HamlParser::Tree::Node::Siblings

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/rails-route-checker/parsers/haml_parser/tree/node.rb

Instance Method Summary collapse

Instance Method Details

#next(node) ⇒ Object



95
96
97
# File 'lib/rails-route-checker/parsers/haml_parser/tree/node.rb', line 95

def next(node)
  subsequents(node).first
end

#previous(node) ⇒ Object



99
100
101
# File 'lib/rails-route-checker/parsers/haml_parser/tree/node.rb', line 99

def previous(node)
  priors(node).last
end

#priors(node) ⇒ Object



103
104
105
106
107
108
109
110
# File 'lib/rails-route-checker/parsers/haml_parser/tree/node.rb', line 103

def priors(node)
  position = position(node)
  if position.zero?
    []
  else
    siblings[0..(position - 1)]
  end
end

#subsequents(node) ⇒ Object



112
113
114
# File 'lib/rails-route-checker/parsers/haml_parser/tree/node.rb', line 112

def subsequents(node)
  siblings[(position(node) + 1)..-1]
end