module ActiveSupport::Inflector
def apply_inflections(word, rules, locale = :en)
Experimental RBS support (using type sampling data from the type_fusion
project).
def apply_inflections: ((String | Symbol) word, Array[Array, Regexp, String] rules, ?Symbol locale) -> String
This signature was generated using 69 samples from 1 application.
apply_inflections('post', inflections.plurals, :en) # => "posts"
found for that locale.
If passed an optional +locale+ parameter, the uncountables will be
Applies inflection rules for +singularize+ and +pluralize+.
def apply_inflections(word, rules, locale = :en) result = word.to_s.dup if word.empty? || inflections(locale).uncountables.uncountable?(result) result else rules.each { |(rule, replacement)| break if result.sub!(rule, replacement) } result end end