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.
-
#inspect ⇒ Object
XXX.
Constructor Details
#initialize(clazz) ⇒ PropertyList
Returns a new instance of PropertyList.
12 13 14 15 |
# File 'lib/couch_potato/persistence/properties.rb', line 12 def initialize(clazz) @clazz = clazz @list = [] end |
Instance Attribute Details
#list ⇒ Object
Returns the value of attribute list.
10 11 12 |
# File 'lib/couch_potato/persistence/properties.rb', line 10 def list @list end |
Instance Method Details
#<<(property) ⇒ Object
21 22 23 |
# File 'lib/couch_potato/persistence/properties.rb', line 21 def <<(property) @list << property end |
#each ⇒ Object
17 18 19 |
# File 'lib/couch_potato/persistence/properties.rb', line 17 def each (list + inherited_properties).each {|property| yield property} end |
#inherited_properties ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/couch_potato/persistence/properties.rb', line 30 def inherited_properties superclazz = @clazz.superclass properties = [] while superclazz && superclazz.respond_to?(:properties) properties << superclazz.properties.list superclazz = superclazz.superclass end properties.flatten end |
#inspect ⇒ Object
XXX
26 27 28 |
# File 'lib/couch_potato/persistence/properties.rb', line 26 def inspect list.map(&:name).inspect end |