Class: CmisServer::RenderableCollection
- Inherits:
-
Object
- Object
- CmisServer::RenderableCollection
- Defined in:
- lib/cmis_server/renderable_collection.rb
Instance Attribute Summary collapse
-
#base_object ⇒ Object
readonly
Returns the value of attribute base_object.
-
#items ⇒ Object
readonly
Returns the value of attribute items.
Instance Method Summary collapse
- #atompub_properties ⇒ Object
- #filter_properties!(filter) ⇒ Object
-
#initialize(base_object:, items:, atompub_properties: nil) ⇒ RenderableCollection
constructor
A new instance of RenderableCollection.
- #total_items_count ⇒ Object
Constructor Details
#initialize(base_object:, items:, atompub_properties: nil) ⇒ RenderableCollection
Returns a new instance of RenderableCollection.
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/cmis_server/renderable_collection.rb', line 9 def initialize(base_object:, items:, atompub_properties: nil) @base_object=base_object @items =items if atompub_properties @atompub_properties={ id: atompub_properties[:id]||SecureRandom.uuid, title: atompub_properties[:title]||'Collection', edited: atompub_properties[:edited]||DateTime.now, updated: atompub_properties[:updated]||DateTime.now, author: atompub_properties[:author]||'Unknown', } end end |
Instance Attribute Details
#base_object ⇒ Object (readonly)
Returns the value of attribute base_object.
6 7 8 |
# File 'lib/cmis_server/renderable_collection.rb', line 6 def base_object @base_object end |
#items ⇒ Object (readonly)
Returns the value of attribute items.
7 8 9 |
# File 'lib/cmis_server/renderable_collection.rb', line 7 def items @items end |
Instance Method Details
#atompub_properties ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/cmis_server/renderable_collection.rb', line 27 def atompub_properties return @atompub_properties if @atompub_properties if @base_object { id: @base_object.cmis_object_id, title: @base_object.cmis_name, edited: DateTime.now, updated: DateTime.now, author: 'unknown', } end end |
#filter_properties!(filter) ⇒ Object
23 24 25 |
# File 'lib/cmis_server/renderable_collection.rb', line 23 def filter_properties!(filter) @properties=@properties.slice(*filter) end |
#total_items_count ⇒ Object
40 41 42 |
# File 'lib/cmis_server/renderable_collection.rb', line 40 def total_items_count nil end |