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