summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authork0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-05-27 03:06:55 +0000
committerk0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-05-27 03:06:55 +0000
commit2e75043a49d5277c04173ba2af233283ae26702d (patch)
tree8c03fc1e630b484940c45e5b1e132a9bf9889086 /lib
parent697c82b69167f021841d139b4321245f8842837a (diff)
downloadruby-2e75043a49d5277c04173ba2af233283ae26702d.tar.gz
erb.rb: Use str_uplus instead of rb_str_dup
to skip unnecessary string allocation on frozen_string_literal: false. str_uplus can bypass calling rb_str_dup when OBJ_FROZEN is true. * Before erb_render 1.064 * Afete erb_render 0.909 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58916 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/erb.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/erb.rb b/lib/erb.rb
index dcd190fcbb..8a6c237f7b 100644
--- a/lib/erb.rb
+++ b/lib/erb.rb
@@ -280,7 +280,7 @@ class ERB
# ERB#src:
#
# compiler = ERB::Compiler.new('<>')
- # compiler.pre_cmd = ["_erbout=''.dup"]
+ # compiler.pre_cmd = ["_erbout=+''"]
# compiler.put_cmd = "_erbout.<<"
# compiler.insert_cmd = "_erbout.<<"
# compiler.post_cmd = ["_erbout"]
@@ -291,7 +291,7 @@ class ERB
# <i>Generates</i>:
#
# #coding:UTF-8
- # _erbout=''.dup; _erbout.<< -"Got "; _erbout.<<(( obj ).to_s); _erbout.<< -"!\n"; _erbout
+ # _erbout=+''; _erbout.<< -"Got "; _erbout.<<(( obj ).to_s); _erbout.<< -"!\n"; _erbout
#
# By default the output is sent to the print method. For example:
#
@@ -861,7 +861,7 @@ class ERB
def set_eoutvar(compiler, eoutvar = '_erbout')
compiler.put_cmd = "#{eoutvar}.<<"
compiler.insert_cmd = "#{eoutvar}.<<"
- compiler.pre_cmd = ["#{eoutvar} = ''.dup"]
+ compiler.pre_cmd = ["#{eoutvar} = +''"]
compiler.post_cmd = [eoutvar]
end