From 861b70e92f4a1fc0e465ffcf2ee62680519c8f6f Mon Sep 17 00:00:00 2001 From: Pablo Herrero Date: Sat, 1 Nov 2014 20:16:03 -0300 Subject: Call gsub with a Regexp instead of a String for better performance --- actionview/lib/action_view/helpers/tag_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionview/lib/action_view/helpers') diff --git a/actionview/lib/action_view/helpers/tag_helper.rb b/actionview/lib/action_view/helpers/tag_helper.rb index 385d57a7a5..b2038576a2 100644 --- a/actionview/lib/action_view/helpers/tag_helper.rb +++ b/actionview/lib/action_view/helpers/tag_helper.rb @@ -123,7 +123,7 @@ module ActionView # cdata_section("hello]]>world") # # => world]]> def cdata_section(content) - splitted = content.to_s.gsub(']]>', ']]]]>') + splitted = content.to_s.gsub(/\]\]\>/, ']]]]>') "".html_safe end -- cgit v1.2.3