Skip to content

Commit 0ba53ee

Browse files
committed
Replace += with << for string concatenation
1 parent 926ab15 commit 0ba53ee

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/gon/helpers.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@ def include_gon(options = {})
99
if Gon.request_env && Gon.all_variables.present?
1010
data = Gon.all_variables
1111
namespace = options[:namespace] || 'gon'
12-
script = "<script>window." + namespace + " = {};"
13-
unless options[:camel_case]
12+
script = '<script>window.' + namespace + ' = {};'
13+
if options[:camel_case]
1414
data.each do |key, val|
15-
script += namespace + "." + key.to_s + '=' + val.to_json + ";"
15+
script << namespace + '.' + key.to_s.camelize(:lower) + '=' + val.to_json + ';'
1616
end
1717
else
1818
data.each do |key, val|
19-
script += namespace + "." + key.to_s.camelize(:lower) + '=' + val.to_json + ";"
19+
script << namespace + '.' + key.to_s + '=' + val.to_json + ';'
2020
end
2121
end
22-
script += "</script>"
22+
script << '</script>'
2323
script.html_safe
2424
else
2525
""

0 commit comments

Comments
 (0)