From: James Coglan Date: 2008-08-27T20:44:46+09:00 Subject: Re: Difficult Inheritance Problem ------=_Part_15061_30373694.1219837759452 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline > > The easiest way I can think of is: > > class Page > class << self > attr_accessor :difference_mapping > end > def self.inherited(c) > c.difference_mapping = difference_mapping > end > end > > Page.difference_mapping = { :blah => :blah } > > class Next < Page > end > > p Next.difference_mapping # { :blah => :blah } Depends whether you only need the definition done once. This technique will not cause the subclass to reflect the parent class' value if it is changed, e.g.: Page.difference_mapping = {:foo => :something} Next.difference_mapping #=> {:blah => :blah} ------=_Part_15061_30373694.1219837759452--