Skip to content

Commit

Permalink
Don't try to destoy the given string via method argument
Browse files Browse the repository at this point in the history
Or it would raise if the argument was frozen.

And even with this change, it would still reduce String allocations together with 9276ea8
because `escape` should be `true` in most cases
  • Loading branch information
amatsuda committed Apr 26, 2018
1 parent 9276ea8 commit 7d2400a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion actionview/lib/action_view/helpers/tag_helper.rb
Expand Up @@ -88,7 +88,7 @@ def tag_option(key, value, escape)
if value.is_a?(Array)
value = escape ? safe_join(value, " ".freeze) : value.join(" ".freeze)
else
value = escape ? ERB::Util.unwrapped_html_escape(value) : value.to_s
value = escape ? ERB::Util.unwrapped_html_escape(value) : value.to_s.dup
end
value.gsub!('"'.freeze, '"'.freeze)
%(#{key}="#{value}")
Expand Down

0 comments on commit 7d2400a

Please sign in to comment.