diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2013-08-03 16:28:38 -0700 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2013-08-03 16:28:38 -0700 |
commit | 75f3616847610b239294790e57863f7c54361783 (patch) | |
tree | db6602623534fd2a9c297dff1f909c26cc26f3e7 | |
parent | e960a646d4424d52cc412d24456745729baf0064 (diff) | |
parent | 512603ee32910bc55b8094a40f6b2bf756f226f3 (diff) | |
download | rails-75f3616847610b239294790e57863f7c54361783.tar.gz rails-75f3616847610b239294790e57863f7c54361783.tar.bz2 rails-75f3616847610b239294790e57863f7c54361783.zip |
Merge pull request #11600 from jasiek/master
Removed an unnecessary loop - it kills performance on large texts.
-rw-r--r-- | actionview/lib/action_view/helpers/text_helper.rb | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/actionview/lib/action_view/helpers/text_helper.rb b/actionview/lib/action_view/helpers/text_helper.rb index e3d4eb1d74..3fc64fa8a5 100644 --- a/actionview/lib/action_view/helpers/text_helper.rb +++ b/actionview/lib/action_view/helpers/text_helper.rb @@ -157,10 +157,12 @@ module ActionView return unless matches = text.match(regex) phrase = matches[0] - text.split(separator).each do |value| - if value.match(regex) - regex = phrase = value - break + unless separator.empty? + text.split(separator).each do |value| + if value.match(regex) + regex = phrase = value + break + end end end |