From: "jonathan leonard Date: 2005-12-11T14:25:46+09:00 Subject: Re: About class methods ruby-ml wrote: > On 2005.12.11 10:34, "jonathan > " > wrote: >> > can be individually extended. Two instances of MyClass, for example, >> > end >> words, must the singleton always be associated with an instance and not >> >> end } >> non-singleton (i.e., many) instances of the subclasses. > Typically, if I understand you correctly, you could just use this > idiom (unless you want to just eval the whole thing): > > # Classes are constants > # | Inherit MyClass > # | | We can use blocks > # | | | > # V V V > MyClassExtension = Class.new(MyClass) { > def self.some_method() > # ... > end > > def some_method() > # ... > end > } > Oooh. That's cool! In the case I was envisioning, I would want to eval the whole thing (so that classes could be extended dynamically at run-time). --J -- Posted via http://www.ruby-forum.com/.