Class: CouchPotato::Persistence::Properties::PropertyList
- Inherits:
-
Object
- Object
- CouchPotato::Persistence::Properties::PropertyList
- Includes:
- Enumerable
- Defined in:
- lib/couch_potato/persistence/properties.rb
Instance Attribute Summary (collapse)
-
- (Object) list
Returns the value of attribute list.
Instance Method Summary (collapse)
- - (Object) <<(property)
- - (Object) each
- - (Object) inherited_properties
-
- (PropertyList) initialize(clazz)
constructor
A new instance of PropertyList.
Constructor Details
- (PropertyList) initialize(clazz)
A new instance of PropertyList
11 12 13 14 |
# File 'lib/couch_potato/persistence/properties.rb', line 11 def initialize(clazz) @clazz = clazz @list = [] end |
Instance Attribute Details
- (Object) list
Returns the value of attribute list
9 10 11 |
# File 'lib/couch_potato/persistence/properties.rb', line 9 def list @list end |
Instance Method Details
- (Object) <<(property)
20 21 22 |
# File 'lib/couch_potato/persistence/properties.rb', line 20 def <<(property) @list << property end |
- (Object) each
16 17 18 |
# File 'lib/couch_potato/persistence/properties.rb', line 16 def each (list + inherited_properties).each {|property| yield property} end |
- (Object) inherited_properties
24 25 26 27 28 29 30 31 32 |
# File 'lib/couch_potato/persistence/properties.rb', line 24 def inherited_properties superclazz = @clazz.superclass properties = [] while superclazz && superclazz.respond_to?(:properties) properties << superclazz.properties.list superclazz = superclazz.superclass end properties.flatten end |