diff options
author | James Golick <james@giraffesoft.ca> | 2010-03-16 09:49:25 -0700 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2010-03-16 10:04:20 -0700 |
commit | 67d8b9743add53f908ca417c641c4a54dd326c7d (patch) | |
tree | cefe33c795c046ed904e21a0f21086ba0c3fafb8 /activesupport | |
parent | 0db68fd1408e52b1edc62b18756ba2662f9b5b3c (diff) | |
download | rails-67d8b9743add53f908ca417c641c4a54dd326c7d.tar.gz rails-67d8b9743add53f908ca417c641c4a54dd326c7d.tar.bz2 rails-67d8b9743add53f908ca417c641c4a54dd326c7d.zip |
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>
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/lib/active_support/multibyte/utils.rb | 2 |
1 files changed, 1 insertions, 1 deletions
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 |