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
-
#list ⇒ Object
Returns the value of attribute list.
Instance Method Summary collapse
- #<<(property) ⇒ Object
- #each ⇒ Object
- #inherited_properties ⇒ Object
-
#initialize(clazz) ⇒ PropertyList
constructor
A new instance of PropertyList.
Constructor Details
#initialize(clazz) ⇒ PropertyList
Returns 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
#list ⇒ Object
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
#<<(property) ⇒ Object
20 21 22 |
# File 'lib/couch_potato/persistence/properties.rb', line 20 def <<(property) @list << property end |
#each ⇒ Object
16 17 18 |
# File 'lib/couch_potato/persistence/properties.rb', line 16 def each (list + inherited_properties).each {|property| yield property} end |
#inherited_properties ⇒ Object
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 |