1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

add instance variable @insert_cmd to change <%='s behavior. (backported 1.15 - 1.16)

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@9915 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
seki 2006-02-12 15:09:25 +00:00
parent 0ba98a12c6
commit 44e28f3c6e
2 changed files with 9 additions and 4 deletions

View file

@ -1,3 +1,8 @@
Mon Feb 13 00:04:00 2006 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
* lib/erb.rb (ERB::Compiler): add instance variable @insert_cmd to
change <%='s behavior. (backported 1.15 - 1.16)
Sat Feb 11 02:04:11 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (eval): no need to push ruby_class. [ruby-dev:28176]

View file

@ -558,7 +558,7 @@ class ERB
out.push(content)
end
when '<%='
out.push("#{@put_cmd}((#{content}).to_s)")
out.push("#{@insert_cmd}((#{content}).to_s)")
when '<%#'
# out.push("# #{content.dump}")
end
@ -607,11 +607,12 @@ class ERB
def initialize(trim_mode)
@percent, @trim_mode = prepare_trim_mode(trim_mode)
@put_cmd = 'print'
@insert_cmd = @put_cmd
@pre_cmd = []
@post_cmd = []
end
attr_reader :percent, :trim_mode
attr_accessor :put_cmd, :pre_cmd, :post_cmd
attr_accessor :put_cmd, :insert_cmd, :pre_cmd, :post_cmd
end
end
@ -705,6 +706,7 @@ class ERB
#
def set_eoutvar(compiler, eoutvar = '_erbout')
compiler.put_cmd = "#{eoutvar}.concat"
compiler.insert_cmd = "#{eoutvar}.concat"
cmd = []
cmd.push "#{eoutvar} = ''"
@ -822,5 +824,3 @@ class ERB
module_function :def_erb_method
end
end