Permalink
Browse files

Improve performance of multibyte utils.

Switch from using String#match to using String#=~. There's no need to
generate a MatchData for each iteration since we're not using it.

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
  • Loading branch information...
1 parent 2d3c580 commit 27aa22826cdd1804c2300716c2a19ebefdad3e33 @jamesgolick jamesgolick committed with jeremy Mar 16, 2010
Showing with 1 addition and 1 deletion.
  1. +1 −1 activesupport/lib/active_support/multibyte/utils.rb
@@ -27,7 +27,7 @@ def self.verify(string)
def self.verify(string)
if expression = valid_character
# Splits the string on character boundaries, which are determined based on $KCODE.
- string.split(//).all? { |c| expression.match(c) }
+ string.split(//).all? { |c| expression =~ c }
else
true
end

0 comments on commit 27aa228

Please sign in to comment.