Class: Text::Gen::Filter::Pluralize
- Defined in:
- lib/text/gen/filter/pluralize.rb
Constant Summary collapse
- EXCEPTIONS =
{ "foot" => "feet", "axis" => "axes", "child" => "children", "codex" => "codices", "die" => "dice", "dwarf" => "dwarves", "goose" => "geese", "elf" => "elves", "man" => "men", "ox" => "oxen", "cactus" => "cacti", "thesis" => "theses", "criterion" => "criteria", "thief" => "thieves", "tooth" => "teeth", "wolf" => "wolves", "woman" => "women" }.freeze
- SINGLE =
Set.new(%w[a an the this his her its my your our that their])
Instance Method Summary collapse
Methods inherited from Base
#component_key, filter_key, filter_name, #initialize, #key, #to_s, #type, #value
Constructor Details
This class inherits a constructor from Text::Gen::Filter::Base
Instance Method Details
#result(context, result) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/text/gen/filter/pluralize.rb', line 29 def result(context, result) return result if @depth && context.depth != @depth text = result.text text = if key && value substitute(text, result.multiplier) elsif key pluralize_by_key(text, result.multiplier, result) else pluralize(text, result.multiplier) end return result if text == result.text Result.from(result, text:, type: component_key) end |