Module: RuboCop::Formatter::TextUtil Private

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Common logic for UI texts.

Class Method Summary collapse

Class Method Details

.pluralize(number, thing, options = {}) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

[View source]

9
10
11
12
13
14
15
16
17
# File 'lib/rubocop/formatter/text_util.rb', line 9

def pluralize(number, thing, options = {})
  if number.zero? && options[:no_for_zero]
    "no #{thing}s"
  elsif number == 1
    "1 #{thing}"
  else
    "#{number} #{thing}s"
  end
end