Re: inspecting the current definition of a method



Phlip wrote:

can one display the current definition of a method

Unfortunately yes. You can use a library called 'rubynode' to reflect the
method's opcodes into a big array of hashes, describing each one.

why unfortunately? because it is not straight forward?

However, Ruby is an extremely dynamic language, and it permits many
tricks using both basic OO programing, and meta-programming techniques
such as define_method. If you call define_method twice, with different
values in the variables around it each time, you can use those variables
inside the new method, and it will vary its behavior each time.

understood. it is precisely one of the reasons that given this flexibility I
would really like to be able "inspect" what a method in a given context
does. The modification of this behavior would then be an additional plus,
but just the plain seeing what the current definition is would be really
helpful in some cases.

but it seems that this is less straight forward than I have hoped

thanks
frank
.



Relevant Pages

  • Re: array formula Excel 97 (Poker)
    ... Since the array trigger is a constant array, ... Ace high straights should always be allowed. ... but J/Q/K/A/2 has never been a straight in any hand I've ...
    (microsoft.public.excel.misc)
  • Re: ADO recordset problem in recursive routine
    ... Sods law, figured it out straight after making my last post. ... Instead of using a second recordset for the children I am using an array ...
    (microsoft.public.data.ado)
  • having trouble using gd imageline in foreach loop
    ... I am trying to take the first 15 numbers of the fibonacci sequence and use them to draw a squarish spiral. ... I am looping through this array so that a line correponding to the fibonacci value will be drawn. ... For some reason I am only getting one straight line going east instead of the four alternating directions. ...
    (comp.lang.php)
  • Re: reading from a file into an array
    ... > from the console into an array and then dumps it into a file. ... > is pretty straight forward and works just fine. ...
    (comp.lang.cpp)