New has_class_attr plugin
Posted November 3, 2009on:
I wrote this as a plugin….but it really has nothing to do with rails. I guess it could be packaged as a gem, but its so small that it probably doesn’t make sense. You ever create class variables or class instance variables and then create getters for them for use as statics?
class MyClass @items = [1,2,3] def self.items @items end end MyClass.items #[1,2,3]
class MyClass has_class_attr :items, :data => [1,2,3] end MyClass.items #[1,2,3]
.script/plugin install git://github.com/angelo0000/has_class_attr.git