Sha256: d1fb011733817aa38bdd37e50a52bf68c487833804c115bc913fdcb13e9cf4f1

Contents?: true

Size: 733 Bytes

Versions: 24

Compression:

Stored size: 733 Bytes

Contents

# frozen_string_literal: true

module Cmdlet
  # Inflection handling routines, eg. pluralize, singular, ordinalize
  module Inflection
    # PluralizeNumberWord: Returns the plural form of the word based on a count with the count prefixed in the format "3 categories"
    class PluralizeNumberWord < Cmdlet::BaseCmdlet
      #
      # @param [String] value - value - value to pluralize
      # @param [Int] count - count used to determine pluralization
      # @return [String] value and number are used to calculate plural/singular form
      def call(value, count)
        return '' if value.nil?

        count = count.to_i if count.is_a? String

        "#{count} #{value.pluralize(count)}"
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
cmdlet-0.14.0 lib/cmdlet/inflection/pluralize_number_word.rb
cmdlet-0.13.2 lib/cmdlet/inflection/pluralize_number_word.rb
cmdlet-0.13.1 lib/cmdlet/inflection/pluralize_number_word.rb
cmdlet-0.13.0 lib/cmdlet/inflection/pluralize_number_word.rb
cmdlet-0.12.5 lib/cmdlet/inflection/pluralize_number_word.rb
cmdlet-0.12.4 lib/cmdlet/inflection/pluralize_number_word.rb
cmdlet-0.12.3 lib/cmdlet/inflection/pluralize_number_word.rb
cmdlet-0.12.2 lib/cmdlet/inflection/pluralize_number_word.rb
cmdlet-0.12.1 lib/cmdlet/inflection/pluralize_number_word.rb
cmdlet-0.12.0 lib/cmdlet/inflection/pluralize_number_word.rb
cmdlet-0.11.0 lib/cmdlet/inflection/pluralize_number_word.rb
cmdlet-0.10.1 lib/cmdlet/inflection/pluralize_number_word.rb
cmdlet-0.10.0 lib/cmdlet/inflection/pluralize_number_word.rb
cmdlet-0.9.2 lib/cmdlet/inflection/pluralize_number_word.rb
cmdlet-0.9.1 lib/cmdlet/inflection/pluralize_number_word.rb
cmdlet-0.9.0 lib/cmdlet/inflection/pluralize_number_word.rb
cmdlet-0.8.0 lib/cmdlet/inflection/pluralize_number_word.rb
cmdlet-0.7.1 lib/cmdlet/inflection/pluralize_number_word.rb
cmdlet-0.7.0 lib/cmdlet/inflection/pluralize_number_word.rb
cmdlet-0.6.2 lib/cmdlet/inflection/pluralize_number_word.rb