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

* lib/erb.rb: adjust line number for magic comment.

* test/erb/test_erb.rb: add tests for def_method.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17610 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
kazu 2008-06-27 08:48:24 +00:00
parent 7a6cafc88e
commit f0bb63782a
3 changed files with 35 additions and 4 deletions

View file

@ -736,16 +736,16 @@ class ERB
if @safe_level
th = Thread.start {
$SAFE = @safe_level
eval(@src, b, (@filename || '(erb)'), 1)
eval(@src, b, (@filename || '(erb)'), 0)
}
return th.value
else
return eval(@src, b, (@filename || '(erb)'), 1)
return eval(@src, b, (@filename || '(erb)'), 0)
end
end
def def_method(mod, methodname, fname='(ERB)') # :nodoc:
mod.module_eval("def #{methodname}\n" + self.src + "\nend\n", fname, 0)
mod.module_eval("def #{methodname}\n" + self.src + "\nend\n", fname, -1)
end
def def_module(methodname='erb') # :nodoc: