From: Jason Roelofs Date: 2006-12-16T00:17:23+09:00 Subject: Re: using Proc and yield ------=_Part_179238_3563273.1166195838583 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline I don't think what you are trying to do is really possible and if it is there's some odd syntax to make it work. Why are you trying to pass blocks into procs? Jason On 12/15/06, Alber Eric wrote: > > hi ! > > I'm new to ruby and I'm currently testing the language. So I know I can > write this: > > def hello() > yield "hello world" > end > > hello { |i| puts i } > > This prints "hello world" on the console, cool. > > Now I wonder if the following code is valid : > > p = Proc.new { yield "hello world" } > > p.call { |i| puts i } > > when I execute this I get the following error : > LocalJumpError: no block given > from (irb):83 > from (irb):85:in `call' > from (irb):85 > from :0 > > > I belived Proc.call was equivalent to a standard method call, it seems > I'm wrong :). Did I misunderstand something? Can someone tell me where I > made a mistake? > > Thank you > > -- > Posted via http://www.ruby-forum.com/. > > ------=_Part_179238_3563273.1166195838583--