Class: Cmdlet::Inflection::PluralizeNumber

Inherits:
BaseCmdlet
  • Object
show all
Defined in:
lib/cmdlet/inflection/pluralize_number.rb

Overview

PluralizeNumber: Returns the plural form of the word based on a count in the format "categories"

Instance Method Summary collapse

Methods inherited from BaseCmdlet

#tokenizer

Instance Method Details

#call(value, count) ⇒ String

Returns value and number are used to calculate plural/singular form.

Parameters:

  • value (String)
    • value - value to pluralize

  • count (Int)
    • count used to determine pluralization

Returns:

  • (String)

    value and number are used to calculate plural/singular form



12
13
14
15
16
17
18
# File 'lib/cmdlet/inflection/pluralize_number.rb', line 12

def call(value, count)
  return '' if value.nil?

  count = count.to_i if count.is_a? String

  value.pluralize(count)
end