Sha256: 48e64f10c52a170005f676d23a395a1dc48695249aebd44a79cf21cbd1026da2

Contents?: true

Size: 398 Bytes

Versions: 7136

Compression:

Stored size: 398 Bytes

Contents

# frozen_string_literal: true

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

      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
    end
  end
end

Version data entries

7,136 entries across 7,097 versions & 51 rubygems

Version Path
dirwatch-0.0.5 vendor/bundle/ruby/2.3.0/gems/rubocop-0.46.0/lib/rubocop/formatter/text_util.rb
dirwatch-0.0.4 vendor/bundle/ruby/2.3.0/gems/rubocop-0.46.0/lib/rubocop/formatter/text_util.rb
dirwatch-0.0.3 vendor/bundle/ruby/2.3.0/gems/rubocop-0.46.0/lib/rubocop/formatter/text_util.rb
dirwatch-0.0.2 vendor/bundle/ruby/2.3.0/gems/rubocop-0.46.0/lib/rubocop/formatter/text_util.rb
rubocop-0.51.0 lib/rubocop/formatter/text_util.rb
rubocop-0.50.0 lib/rubocop/formatter/text_util.rb
rubocop-0.49.1 lib/rubocop/formatter/text_util.rb
rubocop-0.49.0 lib/rubocop/formatter/text_util.rb
rubocop-0.48.1 lib/rubocop/formatter/text_util.rb
rubocop-0.48.0 lib/rubocop/formatter/text_util.rb
rubocop-0.47.1 lib/rubocop/formatter/text_util.rb
rubocop-0.47.0 lib/rubocop/formatter/text_util.rb
rubocop-0.46.0 lib/rubocop/formatter/text_util.rb
rubocop-0.45.0 lib/rubocop/formatter/text_util.rb
rubocop-0.44.1 lib/rubocop/formatter/text_util.rb
rubocop-0.44.0 lib/rubocop/formatter/text_util.rb