Method: ActiveSupport::Inflector::Inflections#singular
- Defined in:
- lib/active_support/inflector/inflections.rb
#singular(rule, replacement) ⇒ Object
Specifies a new singularization rule and its replacement. The rule can either be a string or a regular expression. The replacement should always be a string that may include references to the matched data from the rule.
161 162 163 164 165 |
# File 'lib/active_support/inflector/inflections.rb', line 161 def singular(rule, replacement) @uncountables.delete(rule) if rule.is_a?(String) @uncountables.delete(replacement) @singulars.prepend([rule, replacement]) end |