On May 13, 1:50=A0pm, 7stud -- <bbxx789_0... / yahoo.com> wrote:
> RichardOnRails wrote in post #998460:
>
>
>
> > I have only one question: I put a space between the & and the method
> > following it; the code broke. =A0Is the construct you used documented o=
n-
> > line somewhere? =A0I've peeked at lambda documentation so I've got the
> > drift but I haven't used it in any of my code so far.
>
> Your bible, "The Well-Grounded Rubyist" uses the &:meth_name construct a
> lot, and David Black says that the '&' in '&:meth_name' does two things:
>
> 1) It calls the specified object's to_proc() method. =A0And Symbol#to_pro=
c
> is defined like this:
>
> class Symbol
> =A0 def to_proc
> =A0 =A0 proc{|obj, *args| obj.send(self, *args)}
> =A0 =A0 #self=3D:meth_name
> =A0 end
> end
>
> That just creates a function that takes an object as an argument and
> sends() the :meth_name to the object, i.e. the function calls the
> :meth_name method on the object.
>
> 2) The '&' tells ruby to convert the Proc to a block.
>
> --
> Posted viahttp://www.ruby-forum.com/.

Hi 7stud,

I just your the response you posted a week of two ago, for which I am
grateful

> Your bible, "The Well-Grounded Rubyist" uses the &:meth_name construct a
> lot, and David Black says that...

I had looked at the indices of several books for a reference to the
prefix &, to no avail.  So I abandoned that idea and thus never
checked Black's book.

Thanks to your note,  I see that Black has indexed two dense sections
related to the prefixed &, so I've got them on my To-Do list for
study.

Thanks again for taking the trouble to directing me to Black's
coverage.

Best wishes,
Richard