module RuboCop::Formatter::TextUtil

Common logic for UI texts.

Public Instance Methods

pluralize(number, thing, options = {}) click to toggle source
# File lib/rubocop/formatter/text_util.rb, line 9
def pluralize(number, thing, options = {})
  if number == 0 && options[:no_for_zero]
    "no #{thing}s"
  elsif number == 1
    "1 #{thing}"
  else
    "#{number} #{thing}s"
  end
end