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 =
[SingularRule.new("ies", "y"), SingularRule.new("ves", "fe"), SingularRule.new("ses", "se", SingularRule::Preceding::Vowel), SingularRule.new("sses", "ss"), SingularRule.new("ses", "se", SingularRule::Preceding::AnythingButS), SingularRule.new("xes", "x"), SingularRule.new("zes", "ze"), SingularRule.new("ches", "ch"), SingularRule.new("shes", "sh"), SingularRule.new("s", "")] -
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.