Class: Catalog::CollectionObject::Entry
- Inherits:
-
Object
- Object
- Catalog::CollectionObject::Entry
- Defined in:
- lib/catalog/collection_object/entry.rb
Overview
A Catalog Entry contains the metadata for a “single” collection object Mutiple CatalogEntries would make up a catalog.
Instance Attribute Summary collapse
-
#items ⇒ Object
Each item is a line item in the CatalogEntry, i.e.
-
#reference_collection_object ⇒ Object
The collection object referenced in this entry.
Instance Method Summary collapse
-
#initialize(collection_object = nil) ⇒ Entry
constructor
A new instance of Entry.
-
#ordered_by_date ⇒ Array
Of NomenclatureCatalog::EntryItem sorted by date provided.
Constructor Details
#initialize(collection_object = nil) ⇒ Entry
Returns a new instance of Entry.
13 14 15 16 |
# File 'lib/catalog/collection_object/entry.rb', line 13 def initialize(collection_object = nil) @items = [] @reference_collection_object = collection_object end |
Instance Attribute Details
#items ⇒ Object
Each item is a line item in the CatalogEntry, i.e. a bit of metadata about one specific item (not a list of items in the catalog)
7 8 9 |
# File 'lib/catalog/collection_object/entry.rb', line 7 def items @items end |
#reference_collection_object ⇒ Object
The collection object referenced in this entry
10 11 12 |
# File 'lib/catalog/collection_object/entry.rb', line 10 def reference_collection_object @reference_collection_object end |
Instance Method Details
#ordered_by_date ⇒ Array
Returns of NomenclatureCatalog::EntryItem sorted by date provided.
20 21 22 23 |
# File 'lib/catalog/collection_object/entry.rb', line 20 def ordered_by_date now = Time.now items.sort{|a,b| [(a.start_date || now), a.object_class_name, a.type ] <=> [(b.start_date || now), b.object_class_name, b.type ] } end |