From: Charles Steinman Date: 2005-08-13T04:41:11+09:00 Subject: Re: eval, attr_* like methods Patrick Gundlach wrote: > That's cool. Where does 'Module' come into play? What part of > > class Foo ; end > > is or is related to 'Module'? Hmm, I think I see: class is an instance > of Class, which is a subclass of Module, right? That's right. > > class Class > def lookup_meth(*args) > args.each do |arg| > .... > > should do the same? For classes, yes. It would not work with modules, obviously. > But why is 'def' not a method of Class? Or would > be this too tricky to implement, so it is part of some other level of > parsing? It wouldn't work to make def a method, because what goes after "def" (e.g. "my_cool_method(something, something_else)") isn't a valid object in Ruby. You can use Module#define_method if you want something similar.