From: Kent Dahl Date: 2003-01-17T05:22:51+09:00 Subject: Re: Reading the code passed inside a block? Francis Hwang wrote: > > Is it possible to read the code passed in a block, as, say, a String? > Or in any other way? That is, if I make a method call like: > > > reflector.superReflectiveMethod { |i| i >= 5 } > > is there any way I could get output like > > > You passed in this code: "i >= 5" > > Thanks in advance, Not really, AFAIK. http://www.rubytalk.com/58063 http://www.rubytalk.com/58042 But if you are prepared to "cheat" and do something on the calling side, I've used this explicit trick: http://www.rubytalk.com/54588 -- (\[ Kent Dahl ]/)_ _~_ __[ http://www.stud.ntnu.no/~kentda/ ]___/~ ))\_student_/(( \__d L b__/ NTNU - graduate engineering - 5. year ) ( \__\_�|�_/__/ ) _)Industrial economics and technological management( \____/_�_\____/ (____engineering.discipline_=_Computer::Technology___)