https://github.com/rubyworks/inheritor
Class-level Inhertiable Variables
https://github.com/rubyworks/inheritor
Last synced: 6 months ago
JSON representation
Class-level Inhertiable Variables
- Host: GitHub
- URL: https://github.com/rubyworks/inheritor
- Owner: rubyworks
- License: mit
- Created: 2009-09-25T19:09:14.000Z (over 16 years ago)
- Default Branch: master
- Last Pushed: 2009-10-12T16:54:22.000Z (over 16 years ago)
- Last Synced: 2025-04-02T09:45:13.280Z (about 1 year ago)
- Language: Ruby
- Homepage:
- Size: 292 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README
- Changelog: HISTORY
- License: LICENSE
Awesome Lists containing this project
README
= 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.