On Fri, 1 Dec 2006, John Carter wrote:

> I often do things that take far too much time.
>
> So I create "make" like scripts that understand dependencies and
> targets and when things need to be remade or not.
>
> This saves me heaps and heaps of time.
>
> So I just had the idea that I could pull everything into self
> contained ruby if I could tell if a method had changed or not so I
> would know whether I had to rerun it or not.
>
> Hence the Questions:
>
> Q1. Is there an "uneval" in ruby. ie. Give it a method name, return the
> string that, if eval'd would give the method.
>
> Q2. Is there a "method_hash", which would change if the method had changed.
>
> I suppose I could store the methods as strings, compute an md5sum and then 
> 'eval' the string. Hmm.

   harp:~ > cat a.rb
   class Module
     def method_added *a, &b
       p [a, b]
     end
   end

   class C
     def adding_a_method() end
   end

   harp:~ > ruby a.rb
   [[:method_added], nil]
   [[:adding_a_method], nil]

now you just need to cache them before they are added.

-a
-- 
if you want others to be happy, practice compassion.
if you want to be happy, practice compassion.  -- the dalai lama