From 512603ee32910bc55b8094a40f6b2bf756f226f3 Mon Sep 17 00:00:00 2001 From: Jan Szumiec Date: Thu, 25 Jul 2013 19:29:40 +0100 Subject: Removed an unnecessary loop - it kills performance on large texts. --- actionview/lib/action_view/helpers/text_helper.rb | 10 ++++++---- 1 file 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 -- cgit v1.2.3