On 1/8/07, Trans <transfire / gmail.com> wrote:
>
> Marc Soda wrote:
> > Hey all,
> >
> > Is there a way to get the code (or, more importantly, the variables)
> > out of a block associated with a Proc?  For example:
> >
> > foo = lamdba { a = 'bar'; puts a }
> > p foo.source
> >
> > produces "a = 'bar'; puts a"
> >
> > I thought about extending Proc and saving the block in initialize, but
> > this seems like a lot of overhead if you have a lot of Procs.
> >
> > Any better ideas?
>
> Not the source, but you can use local_varaibles against the binding of
> the proc. Check out Facets' binding methods too which can make it
> easier.
>
>   http://facets.rubyforge.org
>
> T.
>
>
>
Since I'm really only interested in the variables this is perfect.  Thanks!

Marc