public
Description: Quick way to get a class attribute with a getter
Homepage:
Clone URL: git://github.com/angelo0000/has_class_attr.git
name age message
file MIT-LICENSE Sat Oct 31 16:27:29 -0700 2009 initial commit [angelo0000]
file README Sat Oct 31 16:27:29 -0700 2009 initial commit [angelo0000]
file init.rb Sat Oct 31 16:27:29 -0700 2009 initial commit [angelo0000]
directory lib/ Sat Oct 31 16:27:29 -0700 2009 initial commit [angelo0000]
README
HasClassAttr
============

has_class_attr is a small helper plugin.  It really is not tied to rails, but I 
think it is too small for a gem :)

Its purpose is to set a instance variable on a class definition and expose it
through a method.


Example
=======

Old Way:

def MyClass
  @items = [1,2,3]

  def self.static_items
    @items
  end
end

MyClass.static_items #[1,2,3]


New Way:
def MyClass
  has_class_attr :items, :data => [1,2,3]
end

MyClass.items #[1,2,3]




Copyright (c) 2009 StarterStep, released under the MIT license