Permalink
Browse files

Merge pull request #13257 from eshira/optimize-gsub

Replace with gsub! in ActiveSupport::Inflector
  • Loading branch information...
2 parents bd360ad + 88cff33 commit dbe6a8b03b78c0729a39cc849ca8b79752c65235 @josevalim josevalim committed Dec 10, 2013
Showing with 2 additions and 1 deletion.
  1. +2 −1 activesupport/lib/active_support/inflector/methods.rb
@@ -117,7 +117,8 @@ def humanize(lower_case_and_underscored_word, options = {})
result.gsub!(/([a-z\d]*)/i) { |match|
"#{inflections.acronyms[match] || match.downcase}"
}
- options.fetch(:capitalize, true) ? result.gsub(/^\w/) { $&.upcase } : result
+ result.gsub!(/^\w/) { $&.upcase } if options.fetch(:capitalize, true)
+ result
end
# Capitalizes all the words and replaces some characters in the string to

0 comments on commit dbe6a8b

Please sign in to comment.