From b468b45f7a09817ba7c043d0cd4ced531326a58d Mon Sep 17 00:00:00 2001 From: seki Date: Tue, 10 Jan 2006 15:21:45 +0000 Subject: [PATCH] (ERB::Compiler): add instance variable @insert_cmd to change <%='s behavior. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9823 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ lib/erb.rb | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index ef20520eee..f3ee8a8294 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Wed Jan 11 00:12:29 2006 Masatoshi SEKI + + * lib/erb.rb (ERB::Compiler): add instance variable @insert_cmd to + change <%='s behavior. + Tue Jan 10 19:42:33 2006 Tanaka Akira * gc.c (garbage_collect): mark ruby_current_node. diff --git a/lib/erb.rb b/lib/erb.rb index 6b1cdaed20..b714aa1ea6 100644 --- a/lib/erb.rb +++ b/lib/erb.rb @@ -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 - -