From: Asfand Yar Qazi Date: 2005-02-18T06:14:48+09:00 Subject: Re: Evaluating a string of Ruby code within an anonymous module: done correctly? Asfand Yar Qazi wrote: >> >> Just realized how to fix that: >> >> def empty_binding >> binding >> end >> >> def eval_string(s, *args_to_pass) >> pr = eval("proc do |*args| #{s.to_str} end", empty_binding) >> pr[*args_to_pass] >> end >> >> eval_string(<> b = args.collect {|i| i*3} >> c = b.join("||") >> puts(c) >> #p pr #<-- now this fails >> EOL >> Just one thing: why the use of 'proc do ... end ' rather than lambda? I know there's a difference, but I'm not sure what.