module
Amber::Support::Inflector
Defined in:
amber/support/inflector.crConstant Summary
-
IRREGULARS =
{"people" => "person", "men" => "man", "women" => "woman", "children" => "child", "mice" => "mouse", "geese" => "goose", "teeth" => "tooth", "feet" => "foot", "data" => "datum", "criteria" => "criterion", "media" => "medium", "analyses" => "analysis", "oxen" => "ox"} -
SINGULAR_RULES =
[{/ies\z/i, "y"}, {/ves\z/i, "fe"}, {/([aeiou])ses\z/i, "\\1se"}, {/sses\z/i, "ss"}, {/([^s])ses\z/i, "\\1se"}, {/xes\z/i, "x"}, {/zes\z/i, "ze"}, {/ches\z/i, "ch"}, {/shes\z/i, "sh"}, {/s\z/i, ""}] -
Rules ordered from most specific to least specific
Class Method Summary
-
.namespace_to_prefix(namespace : String) : String
Converts a singular English word to a simple prefix-friendly form.
-
.singularize(word : String) : String
Converts a plural English word to its singular form.
Class Method Detail
Converts a singular English word to a simple prefix-friendly form. Used to generate route name prefixes from namespace paths. Strips leading/trailing slashes and replaces inner slashes with underscores.
Converts a plural English word to its singular form.
Handles common English plural patterns. For edge cases,
developers can override with the explicit as: parameter.