From: "trans. (T. Onoma)" Date: 2005-01-18T22:02:23+09:00 Subject: Re: Fwd: [suby-ruby] Your all time desired fundemental Ruby mod On Tuesday 18 January 2005 01:51 am, Martin DeMello wrote: | "trans. (T. Onoma)" wrote: | > BTW I personally like your style: Button.@background ;) | > | :) | : | > Try: | > | > class Button | > class < self | > def background | > @background ||= BLUE | > end | > end | > | > def repaint | > @background = self.class.background | > ... | > end | > end | > | > class ImageButton < Button | > end | > | > That's the idea. Work for you? | | No, becaus the idea is that ImageButton will *not* inherit @background | from Button, it being a separate object. You want it not to inherit? Do you mean the value of @background or the actual method #background? Right now method gets inherited but not the value --you can change the value on a per class bases. But if you did not want the method inherited... I'm not sure. Guess you could use a module. Hmm... I wonder how all the variations might be satisfiable... I wonder if using something like 'inherit' and 'do_not_inherit', like private and public, might not clear all that up. Eg. class A do_not_inherit def self.background #... end inherit def repaint #... end end T.