||2002-11-19 17:54:38 GMT
||2004-06-11 23:29:54 GMT
(Projects of this owner)
The Ruby inheritance system is a powerful way to organize methods and constants
in a hierarchy of classes and modules. However, it does not provide an easy way
to organize inherited attribute values in such a hierarchy. A class variable is
stored in the base class in which it was defined; its value can be changed by a
subclass, but that change propagates to all subclasses of the base class. A
class instance variable can take on a different value in each subclass, but
there is no inheritance mechanism; its value is privately accessible by its
owner, and does not propagate to subclasses.
SuperHash solves this class attribute problem and in addition is a
general mechanism for defining attribute inheritance structures among objects
of any type, not just classes. An example of the former is StateObject,
in examples/state-object.rb. An example of the latter is
AttributedNode defined in examples/attributed-node.rb.
- Fixed broken #index.
- Updated for ruby-1.8 and ruby-1.9.