Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
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...
commit d3071db1200e90c0533f75b967c4afb519656d00 1 parent 815e445
@fxn fxn authored
Showing with 1 addition and 1 deletion.
  1. +1 −1  activesupport/lib/active_support/inflector/methods.rb
View
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])
@fxn Owner
fxn added a note

Redundant 0 removed in dc03a2f.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
result
else
rules.each { |(rule, replacement)| break if result.gsub!(rule, replacement) }
Please sign in to comment.
Something went wrong with that request. Please try again.