Skip to content
Browse files

boosts inflections

The impact of this change has been measured pluralizing
the entire /usr/share/dict/words, showing a 6x speedup
  • Loading branch information...
1 parent 815e445 commit d3071db1200e90c0533f75b967c4afb519656d00 @fxn fxn committed Feb 12, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 activesupport/lib/active_support/inflector/methods.rb
2 activesupport/lib/active_support/inflector/methods.rb
@@ -308,7 +308,7 @@ def const_regexp(camel_cased_word) #:nodoc:
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])
Ruby on Rails member
fxn added a note Feb 13, 2012

Redundant 0 removed in dc03a2f.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
rules.each { |(rule, replacement)| break if result.gsub!(rule, replacement) }

0 comments on commit d3071db

Please sign in to comment.
Something went wrong with that request. Please try again.