diff options
author | Xavier Noria <fxn@hashref.com> | 2012-02-12 15:49:44 -0800 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2012-02-12 15:58:10 -0800 |
commit | d3071db1200e90c0533f75b967c4afb519656d00 (patch) | |
tree | dc7919de4c03b3e694d7cd06b3be34f02df4a0cb /activesupport/lib/active_support | |
parent | 815e4453310858f9cfbccf4b41f943c9448aea07 (diff) | |
download | rails-d3071db1200e90c0533f75b967c4afb519656d00.tar.gz rails-d3071db1200e90c0533f75b967c4afb519656d00.tar.bz2 rails-d3071db1200e90c0533f75b967c4afb519656d00.zip |
boosts inflections
The impact of this change has been measured pluralizing
the entire /usr/share/dict/words, showing a 6x speedup
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r-- | activesupport/lib/active_support/inflector/methods.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/inflector/methods.rb b/activesupport/lib/active_support/inflector/methods.rb index 4b7c36f839..b1ff92151e 100644 --- a/activesupport/lib/active_support/inflector/methods.rb +++ b/activesupport/lib/active_support/inflector/methods.rb @@ -308,7 +308,7 @@ module ActiveSupport def apply_inflections(word, rules) result = word.to_s.dup - if word.empty? || inflections.uncountables.any? { |inflection| result =~ /\b#{inflection}\Z/i } + if word.empty? || inflections.uncountables.include?(result.downcase[/\b\w+\Z/, 0]) result else rules.each { |(rule, replacement)| break if result.gsub!(rule, replacement) } |