Sha256: 8c3f8a4e11a24e20b1ec623fe7d03be6039271012efb393d212e6dead54c33b3

Contents?: true

Size: 433 Bytes

Versions: 11

Compression:

Stored size: 433 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]
                 'no'
               else
                 number.to_s
               end

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

        text
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
rubocop-0.35.1 lib/rubocop/formatter/text_util.rb
rubocop-0.35.0 lib/rubocop/formatter/text_util.rb
rubocop-0.34.2 lib/rubocop/formatter/text_util.rb
rubocop-0.34.1 lib/rubocop/formatter/text_util.rb
rubocop-0.34.0 lib/rubocop/formatter/text_util.rb
rubocop-0.33.0 lib/rubocop/formatter/text_util.rb
rubocop-0.32.1 lib/rubocop/formatter/text_util.rb
rubocop-0.32.0 lib/rubocop/formatter/text_util.rb
rubocop-0.31.0 lib/rubocop/formatter/text_util.rb
rubocop-0.30.1 lib/rubocop/formatter/text_util.rb
rubocop-0.30.0 lib/rubocop/formatter/text_util.rb