aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Schneeman <richard.schneeman@gmail.com>2015-08-02 12:08:17 -0500
committerRichard Schneeman <richard.schneeman@gmail.com>2015-08-02 12:08:17 -0500
commit1c912125ac4ba066c6924e553349d98ca68f008d (patch)
tree9526008d499969b9587670095fffeecd91b386c7
parent13beb92a1ee189b64d3121213b7b8fcbf25a60ea (diff)
parentd531edc829101d9969273f7f0f920c05000d6e62 (diff)
downloadrails-1c912125ac4ba066c6924e553349d98ca68f008d.tar.gz
rails-1c912125ac4ba066c6924e553349d98ca68f008d.tar.bz2
rails-1c912125ac4ba066c6924e553349d98ca68f008d.zip
Merge pull request #21098 from bquorning/shovel-twice-and-save-a-string
Save a string allocation inside loop
-rw-r--r--actionview/lib/action_view/helpers/tag_helper.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/actionview/lib/action_view/helpers/tag_helper.rb b/actionview/lib/action_view/helpers/tag_helper.rb
index 30af09cbac..2562504896 100644
--- a/actionview/lib/action_view/helpers/tag_helper.rb
+++ b/actionview/lib/action_view/helpers/tag_helper.rb
@@ -154,12 +154,17 @@ module ActionView
options.each_pair do |key, value|
if TAG_PREFIXES.include?(key) && value.is_a?(Hash)
value.each_pair do |k, v|
- output << sep + prefix_tag_option(key, k, v, escape)
+ output << sep
+ output << prefix_tag_option(key, k, v, escape)
end
elsif BOOLEAN_ATTRIBUTES.include?(key)
- output << sep + boolean_tag_option(key) if value
+ if value
+ output << sep
+ output << boolean_tag_option(key)
+ end
elsif !value.nil?
- output << sep + tag_option(key, value, escape)
+ output << sep
+ output << tag_option(key, value, escape)
end
end
output unless output.empty?