README.tmpl in fattr-1.0.1 vs README.tmpl in fattr-1.0.2
- old
+ new
@@ -8,14 +8,16 @@
http://codeforpeople.com/lib/ruby
http://rubyforge.org/projects/codeforpeople/
http://codeforpeople.rubyforge.org/svn/
SYNOPSIS
- fattr.rb is a "fatter attr" for ruby. fattr.rb supercedes attributes.rb as
- that library, even though it added only one method to the global namespace,
- collided too frequently with user code - in particular rails' code.
+ fattr.rb is a "fatter attr" for ruby.
+ fattr.rb supercedes attributes.rb as that library, even though it added only
+ one method to the global namespace, collided too frequently with user code -
+ in particular rails' code.
+
the implementation of fattr.rb borrows many of the best ideas from the
metakoans.rb ruby quiz
http://www.rubyquiz.com/quiz67.html
@@ -44,13 +46,32 @@
- getters acts as setters if an argument is given to them
- block caching, calling an fattr with a block sets the instance
variable to that block
+ - shortcuts for adding class/module level fattrs
+
all this in < 100 lines of code
HISTORY
- 5.0.0:
+ 1.0.2:
+ added Fattr shortcut for adding class/module level fattrs
+
+ class C
+ Fattr 'children' => []
+
+ def C.inherited other
+ (children << other).uniq!
+ super
+ end
+ end
+
+ class B < C
+ end
+
+ p C.children #=> B
+
+ 1.0.0:
port from attributes.rb retaining all the same features of that version of
attributes.rb
SAMPLES
@samples