From 62b368dc4ae950b8218097cafc9fc4591e1093de Mon Sep 17 00:00:00 2001 From: aamine Date: Wed, 10 Dec 2003 09:07:52 +0000 Subject: [PATCH] * lib/erb.rb: new method ERB#filename(=). [ruby-dev:22208] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5161 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 4 ++++ lib/erb.rb | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index cc44a05083..54115c3d36 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Wed Dec 10 18:07:25 2003 Minero Aoki + + * lib/erb.rb: new method ERB#filename(=). [ruby-dev:22208] + Wed Dec 10 17:54:51 2003 Nobuyoshi Nakada * ext/stringio/stringio.c (strio_read): do not set EOF flag when diff --git a/lib/erb.rb b/lib/erb.rb index 1b712c92c2..4e3aaf4a86 100644 --- a/lib/erb.rb +++ b/lib/erb.rb @@ -387,8 +387,10 @@ class ERB compiler = ERB::Compiler.new(trim_mode) set_eoutvar(compiler, eoutvar) @src = compiler.compile(str) + @filename = nil end - attr :src + attr_reader :src + attr_accessor :filename def set_eoutvar(compiler, eoutvar = '_erbout') compiler.put_cmd = "#{eoutvar}.concat" @@ -416,7 +418,7 @@ class ERB } return th.value else - return eval(@src, b) + return eval(@src, b, (@filename || '(erb)'), 1) end end