From: dblack@... Date: 2006-03-24T00:48:22+09:00 Subject: Re: specify a mandatory block parameter Hi -- On Fri, 24 Mar 2006, 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). Consider this: a.each {|b| puts b.capitalize } That's a method call with a block. But the block is just a syntactic construct; it's not a Proc object. You can convert back and forth between blocks and Procs, in various ways, but there is such a thing as a block that is just a block. David > -- > 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 >> >> > > -- David A. Black (dblack@wobblini.net) Ruby Power and Light, LLC (http://www.rubypowerandlight.com) "Ruby for Rails" chapters now available from Manning Early Access Program! http://www.manning.com/books/black