Class: Catalog::CollectionObject::EntryItem
- Inherits:
-
Object
- Object
- Catalog::CollectionObject::EntryItem
- Defined in:
- lib/catalog/collection_object/entry_item.rb
Overview
Is 1:1 with an event in the history of the object, as indexed by date (range)
Instance Attribute Summary collapse
-
#end_date ⇒ Object
The latest point at which the event could have happened.
-
#object ⇒ Object
The base object from which this event is derived, required.
-
#start_date ⇒ Object
The earliest point at which the event could have happened.
-
#type ⇒ Object
Arbitrary categorization of event as per EVENT_TYPES, required TODO: this is a terrible method name.
Instance Method Summary collapse
-
#initialize(object: nil, type: nil, start_date: nil, end_date: nil) ⇒ EntryItem
constructor
A new instance of EntryItem.
- #object_class_name ⇒ String
Constructor Details
#initialize(object: nil, type: nil, start_date: nil, end_date: nil) ⇒ EntryItem
Returns a new instance of EntryItem.
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/catalog/collection_object/entry_item.rb', line 19 def initialize(object: nil, type: nil, start_date: nil, end_date: nil) raise TaxonWorks::Error, ':object is nil' if object.nil? raise TaxonWorks::Error, ':type is nil' if type.nil? raise TaxonWorks::Error, 'type is not in the list' if !Catalog::CollectionObject::EVENT_TYPES.include?(type) raise TaxonWorks::Error, 'start_date is not a Time' if start_date && !start_date.kind_of?(Time) raise TaxonWorks::Error, 'end_date is not a Time' if end_date && !end_date.kind_of?(Time) @object = object @start_date = start_date @type = type @end_date = end_date end |
Instance Attribute Details
#end_date ⇒ Object
The latest point at which the event could have happened.
16 17 18 |
# File 'lib/catalog/collection_object/entry_item.rb', line 16 def end_date @end_date end |
#object ⇒ Object
The base object from which this event is derived, required
5 6 7 |
# File 'lib/catalog/collection_object/entry_item.rb', line 5 def object @object end |
#start_date ⇒ Object
The earliest point at which the event could have happened. If end_date is not provided assumed to be exact
13 14 15 |
# File 'lib/catalog/collection_object/entry_item.rb', line 13 def start_date @start_date end |
#type ⇒ Object
Arbitrary categorization of event as per EVENT_TYPES, required TODO: this is a terrible method name
9 10 11 |
# File 'lib/catalog/collection_object/entry_item.rb', line 9 def type @type end |
Instance Method Details
#object_class_name ⇒ String
33 34 35 |
# File 'lib/catalog/collection_object/entry_item.rb', line 33 def object_class_name object.class.name end |