Sha256: aa0d5638dd3c3ac15ff4445817252c46271ea09258e4d3cace52f8b5d6b82cab

Contents?: true

Size: 432 Bytes

Versions: 5

Compression:

Stored size: 432 Bytes

Contents

# encoding: utf-8

module RuboCop
  module Formatter
    # Common logic for UI texts.
    module TextUtil
      module_function

      def pluralize(number, thing, options = {})
        text = ''

        if number == 0 && options[:no_for_zero]
          text = 'no'
        else
          text << number.to_s
        end

        text << " #{thing}"
        text << 's' unless number == 1

        text
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rubocop-0.29.1 lib/rubocop/formatter/text_util.rb
rubocop-0.29.0 lib/rubocop/formatter/text_util.rb
rubocop-0.28.0 lib/rubocop/formatter/text_util.rb
rubocop-0.27.1 lib/rubocop/formatter/text_util.rb
rubocop-0.27.0 lib/rubocop/formatter/text_util.rb