From: Robert Klemme Date: 2006-03-24T00:48:53+09:00 Subject: Re: specify a mandatory block parameter 13 wrote: > Hi, > > I'm not sure how blocks are treated internally by Ruby (if some expert > can tell us, then it would be great) but when we are using blocks in > our Ruby code then they are objects of class Proc (again, please, > confirm someone if I'm wrong). > > -- > Martins > > > On 3/23/06, Eric Schwartz wrote: >> 13 writes: >>> Blocks are actually objects of class Proc >> Are you sure? I did a lot of reading up on blocks lately, and from >> what I learned, blocks are one of the very few things in Ruby that are >> not objects. You can, however, automatically convert them to Proc >> objects if you need to; maybe that's what you're noticing? >> >> -=Eric Actually Eric is right. They are only objects if you request them to be. def foo # no object yield 1 end def bar(&b) # Proc instance b[2] end Kind regards robert