summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorseki <seki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-01-10 15:21:45 +0000
committerseki <seki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-01-10 15:21:45 +0000
commitb468b45f7a09817ba7c043d0cd4ced531326a58d (patch)
tree5bcfcf5fc87d91d21bd33412dc7866343146aa7f /lib
parent3428af761c3dec31cbe8a4076c36ef674b6c4b49 (diff)
(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
Diffstat (limited to 'lib')
-rw-r--r--lib/erb.rb8
1 files changed, 4 insertions, 4 deletions
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
-
-