In article <42F1BBE4.8020605 / capitain.de>,
Pit Capitain  <pit / capitain.de> wrote:
>Alexandru Popescu schrieb:
>> Is there any metadata that can be associated with a method? I know it is 
>> an object, and maybe you can attach some metadata to it. From that point 
>> on the things will be more simple.
>
>No, you can't attach metadata to methods, but you can attach them to the 
>class or module where the methods are defined. I think this should be 
>enough for something like TestNG. For more info look into the archives 
>of ruby-talk or ruby-core (I don't remember where).
>

Why couldn't you add metadata to methods?

  class Metod
    def metadata
      @metadata
    end

    def metadata= data
      @metadata = data
    end
  end

  def foo
    "foo"
  end


  foometh = self.method(:foo)
  
  foometh.metadata = "This method just says foo"
  
  puts foometh.metadata #=> This method just says foo


Phil