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

#initialize(collection_object = nil) ⇒ CatalogEntry

Returns a new instance of CatalogEntry

Parameters:

  • args (Hash)


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

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

Instance Attribute Details

#itemsObject

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

#reference_collection_objectObject

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

#ordered_by_dateArray

Returns of NomenclatureCatalog::EntryItem sorted by date provided

Returns:

  • (Array)

    of NomenclatureCatalog::EntryItem sorted by date provided



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

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