lib/scss_lint/utils.rb in scss-lint-0.11.1 vs lib/scss_lint/utils.rb in scss-lint-0.12.0
- old
+ new
@@ -1,6 +1,7 @@
module SCSSLint
+ # Collection of helpers used across a variety of linters.
module Utils
# Given a selector array which is a list of strings with Sass::Script::Nodes
# interspersed within them, return an array of strings representing those
# selectors with the Sass::Script::Nodes removed (i.e., ignoring
# interpolation). For example:
@@ -51,9 +52,13 @@
if index == 0
parent
else
parent.children[index - 1]
end
+ end
+
+ def pluralize(value, word)
+ value == 1 ? "#{value} #{word}" : "#{value} #{word}s"
end
private
INVALID_NAME_CHARS = '[_A-Z]'