Class: Garcon::Inflections::RulesCollection

Inherits:
Array show all
Defined in:
lib/garcon/inflections/rules_collection.rb

Overview

Wraps inflections array

Instance Method Summary collapse

Methods inherited from Array

#object_state, #sample

Instance Method Details

#apply_to(word) ⇒ String

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Applies first found rule to given word



30
31
32
33
34
# File 'lib/garcon/inflections/rules_collection.rb', line 30

def apply_to(word)
  result = word.dup
  each { |rule, replacement| break if result.gsub!(rule, replacement) }
  result
end