-
Notifications
You must be signed in to change notification settings - Fork 0
Quick way to get a class attribute with a getter
License
angelo0000/has_class_attr
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
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
About
Quick way to get a class attribute with a getter
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published