T
trans. (T. Onoma)
Is there a reason Kernel#eval won't take a block? I wrote this to overcome:
# Evaluate a Ruby source code string (or block) in the binding context
def evalb( str=nil, binding=nil, &blk )
if block_given?
Kernel.eval( "proc {|slf, blk| slf.instance_eval(&blk)}",
binding ).call( binding, blk )
elsif str
Kernel.eval( str, binding )
end
end
Although, I'm not sure it's exactly right --I put it together by a bit of
trial and error.
T.
--
( o _ カラãƒ
// trans.
/ \ (e-mail address removed)
I don't give a damn for a man that can only spell a word one way.
-Mark Twain
# Evaluate a Ruby source code string (or block) in the binding context
def evalb( str=nil, binding=nil, &blk )
if block_given?
Kernel.eval( "proc {|slf, blk| slf.instance_eval(&blk)}",
binding ).call( binding, blk )
elsif str
Kernel.eval( str, binding )
end
end
Although, I'm not sure it's exactly right --I put it together by a bit of
trial and error.
T.
--
( o _ カラãƒ
// trans.
/ \ (e-mail address removed)
I don't give a damn for a man that can only spell a word one way.
-Mark Twain