Permalink
Browse files

Merge pull request #11600 from jasiek/master

Removed an unnecessary loop - it kills performance on large texts.
  • Loading branch information...
2 parents e960a64 + 512603e commit 75f3616847610b239294790e57863f7c54361783 @rafaelfranca rafaelfranca committed Aug 3, 2013
Showing with 6 additions and 4 deletions.
  1. +6 −4 actionview/lib/action_view/helpers/text_helper.rb
@@ -157,10 +157,12 @@ def excerpt(text, phrase, options = {})
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

0 comments on commit 75f3616

Please sign in to comment.