From: Brian Ross
Date: 2008-08-30T06:14:29+09:00
Subject: Re: Writing a method to handle a code block?
------=_Part_20598_28250285.1220044758956
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Thank you, everyone. If I understand correctly:
&foo just means that whatever is passed to it (& requires a code block) will
be saved as a local variable that may be used later.
The call method executes the block that it acts on and then executes it but
first assigns the block's | block argument | to the parameter passed to it.
Is it then that yield functions the same as the call method? I haven't quite
gotten to proc objects yet, but it looks like using & converts the code
block into an object, but yield, strictly, doesn't? Are code blocks the
exception to the "everything in ruby is an object" rule?
I'm certainly understanding this far better than I was previously, I think.
Brian
------=_Part_20598_28250285.1220044758956--