Class: CollectionObjectCatalog::CatalogEntry

Inherits:
Object
  • Object
show all
Defined in:
lib/collection_object_catalog/catalog_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)

Instance Method Summary (collapse)

Constructor Details

- (CatalogEntry) initialize(collection_object = nil)

Returns a new instance of CatalogEntry



14
15
16
17
# File 'lib/collection_object_catalog/catalog_entry.rb', line 14

def initialize(collection_object = nil)
  @items = []
  @reference_collection_object = collection_object
end

Instance Attribute Details

- (Object) items

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)



9
10
11
# File 'lib/collection_object_catalog/catalog_entry.rb', line 9

def items
  @items
end

- (Object) reference_collection_object

The collection object referenced in this entry



12
13
14
# File 'lib/collection_object_catalog/catalog_entry.rb', line 12

def reference_collection_object
  @reference_collection_object
end

Instance Method Details

- (Array of NomenclatureCatalog::EntryItem) ordered_by_date

Returns sorted by date provided

Returns:



21
22
23
24
# File 'lib/collection_object_catalog/catalog_entry.rb', line 21

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