lib/scss_lint/utils.rb in scss-lint-0.24.1 vs lib/scss_lint/utils.rb in scss-lint-0.25.0
- old
+ new
@@ -39,10 +39,24 @@
else
parent.children[index - 1]
end
end
+ def node_siblings(node)
+ return unless node && node.node_parent
+ node.node_parent
+ .children
+ .select { |child| child.is_a?(Sass::Tree::Node) }
+ end
+
def pluralize(value, word)
value == 1 ? "#{value} #{word}" : "#{value} #{word}s"
+ end
+
+ # Sass doesn't define an equality operator for Sass::Source::Position
+ # objects, so we define a helper for our own use.
+ def same_position?(pos1, pos2)
+ return unless pos1 && pos2
+ pos1.line == pos2.line && pos1.offset == pos2.offset
end
end
end