* 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
This commit is contained in:
parent
ba18b0c6cb
commit
62b368dc4a
@ -1,3 +1,7 @@
|
|||||||
|
Wed Dec 10 18:07:25 2003 Minero Aoki <aamine@loveruby.net>
|
||||||
|
|
||||||
|
* lib/erb.rb: new method ERB#filename(=). [ruby-dev:22208]
|
||||||
|
|
||||||
Wed Dec 10 17:54:51 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Wed Dec 10 17:54:51 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* ext/stringio/stringio.c (strio_read): do not set EOF flag when
|
* ext/stringio/stringio.c (strio_read): do not set EOF flag when
|
||||||
|
@ -387,8 +387,10 @@ class ERB
|
|||||||
compiler = ERB::Compiler.new(trim_mode)
|
compiler = ERB::Compiler.new(trim_mode)
|
||||||
set_eoutvar(compiler, eoutvar)
|
set_eoutvar(compiler, eoutvar)
|
||||||
@src = compiler.compile(str)
|
@src = compiler.compile(str)
|
||||||
|
@filename = nil
|
||||||
end
|
end
|
||||||
attr :src
|
attr_reader :src
|
||||||
|
attr_accessor :filename
|
||||||
|
|
||||||
def set_eoutvar(compiler, eoutvar = '_erbout')
|
def set_eoutvar(compiler, eoutvar = '_erbout')
|
||||||
compiler.put_cmd = "#{eoutvar}.concat"
|
compiler.put_cmd = "#{eoutvar}.concat"
|
||||||
@ -416,7 +418,7 @@ class ERB
|
|||||||
}
|
}
|
||||||
return th.value
|
return th.value
|
||||||
else
|
else
|
||||||
return eval(@src, b)
|
return eval(@src, b, (@filename || '(erb)'), 1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user