From 67d8b9743add53f908ca417c641c4a54dd326c7d Mon Sep 17 00:00:00 2001 From: James Golick Date: Tue, 16 Mar 2010 09:49:25 -0700 Subject: 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 --- activesupport/lib/active_support/multibyte/utils.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/activesupport/lib/active_support/multibyte/utils.rb b/activesupport/lib/active_support/multibyte/utils.rb index b243df46d8..94b393cee2 100644 --- a/activesupport/lib/active_support/multibyte/utils.rb +++ b/activesupport/lib/active_support/multibyte/utils.rb @@ -27,7 +27,7 @@ module ActiveSupport #:nodoc: 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 -- cgit v1.2.3