Module: Hanami::Utils::Inflector
- Includes:
- ClassAttribute
- Defined in:
- gems/gems/hanami-utils-1.3.3/lib/hanami/utils/inflector.rb,
gems/gems/hanami-utils-1.3.8/lib/hanami/utils/inflector.rb
Overview
String inflector
Class Method Summary collapse
-
.exception(singular, plural) ⇒ Object
Adds a custom inflection exception.
-
.inflections(&blk) ⇒ Object
Block for custom inflection rules.
-
.uncountable(*words) ⇒ Object
Adds an uncountable word.
Class Method Details
.exception(singular, plural) ⇒ Object
Adds a custom inflection exception
Source: | on GitHub
def self.exception(singular, plural) add_to_inflecto(singular, plural) singulars.add(plural, singular) plurals.add(singular, plural) end |
.inflections(&blk) ⇒ Object
Block for custom inflection rules.
Source: | on GitHub
def self.inflections(&blk) class_eval(&blk) end |
.uncountable(*words) ⇒ Object
Adds an uncountable word
Source: | on GitHub
def self.uncountable(*words) Array(words).each do |word| exception(word, word) end end |