Class: Catalog::CollectionObject::Entry

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initialize(collection_object = nil) ⇒ Entry

Returns a new instance of Entry.

Parameters:

  • args (Hash)


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

#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)



7
8
9
# File 'lib/catalog/collection_object/entry.rb', line 7

def items
  @items
end

#reference_collection_objectObject

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_dateArray

Returns of NomenclatureCatalog::EntryItem sorted by date provided.

Returns:

  • (Array)

    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