/inheritor

Class-level Inhertiable Variables

Primary LanguageRubyMIT LicenseMIT

= Inheritor

* http://rubyworks.github.com/inheritor
* http://github.com/rubyworks/inheritor


== DESCRIPTION

Inheritor provides a means to store and inherit data along the class
heirarchy. An inheritor creates two methods, one named after for the
+key+ that provides a reader, and one named +key!+ which provides
the writer. Because of the unique nature of Inheritor, the reader
cannot be used to modify the underlying store b/c it is a calculated
attribute, thus any modifications to the result would not be passed on
to the descendents.

The most notable feature of Inheritor is that it is dynamic. Unlike other
solutions, such as ActiveSupport's +class_inheritable_accessor+, Inheritor
dynamically generates the inherited value whenever the reader is called,
as opposed to copying the parents variable value upon class creation or
some other specific trigger.


== FEATURES/ISSUES

* Create inheritable attributes.
* Works with modules, providing module method inheritance.
* Easily handles any data and inheritance type.


== RELEASE NOTES

Please see HISTORY file.


== SYNOPSIS

To create an inheritable class variable provide the #inheritor method
with the name of the variable, it's initial value, and the methdod
to be used to process inheritence from descendent to descendent.

   class X
     inheritor :foo, [], :+
   end

   class Y < X
   end

   X.x! << :a
   X.x => [:a]
   Y.x => [:a]

   Y.x! << :b
   X.x => [:a]
   Y.x => [:a, :b]


== HOW TO INSTALL

To install with RubyGems simply open a console and type:

  gem install inheritor

Local installation requires Setup.rb (gem install setup),
then download the tarball package and type:

  tar -xvzf inheritor-1.0.0.tgz
  cd inheritor-1.0.0
  sudo setup.rb all

Windows users use 'ruby setup.rb all'.


== COPYING

(MIT License)

Copyright (c) 2004 Thomas Sawyer

This program is ditributed unser the terms of the MIT license.

See LICENSE or COPYING file for details.