Class: DigitalScriptorium::DsMeta

Inherits:
Object
  • Object
show all
Includes:
ItemId, PropertyId
Defined in:
lib/digital_scriptorium/ds_meta.rb

Overview

Represents a meta record consisting of a manuscript, its holding information, and metadata record.

Constant Summary

Constants included from PropertyId

PropertyId::ACKNOWLEDGEMENTS, PropertyId::ASSOCIATED_NAME_AS_RECORDED, PropertyId::CENTURY, PropertyId::DATED, PropertyId::DATE_ADDED, PropertyId::DATE_LAST_UPDATED, PropertyId::DESCRIBED_MANUSCRIPT, PropertyId::DS_ID, PropertyId::EARLIEST_DATE, PropertyId::END_TIME, PropertyId::EQUIVALENT_PROPERTY, PropertyId::EXTERNAL_IDENTIFIER, PropertyId::EXTERNAL_URI, PropertyId::FORMATTER_URL, PropertyId::GENRE_AS_RECORDED, PropertyId::HOLDING_INSTITUTION_AS_RECORDED, PropertyId::HOLDING_INSTITUTION_IN_AUTHORITY_FILE, PropertyId::HOLDING_STATUS, PropertyId::IIIF_MANIFEST, PropertyId::INSTANCE_OF, PropertyId::INSTITUTIONAL_ID, PropertyId::IN_ORIGINAL_SCRIPT, PropertyId::LANGUAGE_AS_RECORDED, PropertyId::LANGUAGE_IN_AUTHORITY_FILE, PropertyId::LATEST_DATE, PropertyId::LINK_TO_INSTITUTIONAL_RECORD, PropertyId::MANUSCRIPT_HOLDING, PropertyId::MATERIAL_AS_RECORDED, PropertyId::MATERIAL_IN_AUTHORITY_FILE, PropertyId::NAME_IN_AUTHORITY_FILE, PropertyId::NOTE, PropertyId::PHYSICAL_DESCRIPTION, PropertyId::PLACE_IN_AUTHORITY_FILE, PropertyId::PRODUCTION_CENTURY_IN_AUTHORITY_FILE, PropertyId::PRODUCTION_DATE_AS_RECORDED, PropertyId::PRODUCTION_PLACE_AS_RECORDED, PropertyId::ROLE_IN_AUTHORITY_FILE, PropertyId::SHELFMARK, PropertyId::STANDARD_TITLE, PropertyId::START_TIME, PropertyId::SUBCLASS_OF, PropertyId::SUBJECT_AS_RECORDED, PropertyId::TERM_IN_AUTHORITY_FILE, PropertyId::TITLE_AS_RECORDED, PropertyId::UNIFORM_TITLE_AS_RECORDED, PropertyId::VIAF_ID, PropertyId::WIKIDATA_QID

Constants included from ItemId

ItemId::ACTOR, ItemId::CENTURY, ItemId::CORE_MODEL_ITEMS, ItemId::CORPORATE_NAME, ItemId::DATED, ItemId::DS_20_RECORD, ItemId::HOLDING, ItemId::HOLDING_STATUS_CURRENT, ItemId::HOLDING_STATUS_NON_CURRENT, ItemId::LANGUAGE, ItemId::MANUSCRIPT, ItemId::MATERIAL, ItemId::PERSONAL_NAME, ItemId::PLACE, ItemId::ROLE, ItemId::STANDARD_TITLE, ItemId::TERM, ItemId::UNDATED

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(record, export_hash) ⇒ DsMeta



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/digital_scriptorium/ds_meta.rb', line 11

def initialize(record, export_hash)
  manuscript = export_hash[record.described_manuscript_id]
  current_holdings = current_holdings(manuscript, export_hash)

  if current_holdings.size != 1
    raise "Manuscripts must have exactly 1 current holding, found #{current_holdings.size}"
  end

  @holding = current_holdings.first
  @manuscript = manuscript
  @record = record
end

Instance Attribute Details

#holdingObject (readonly)

Returns the value of attribute holding.



9
10
11
# File 'lib/digital_scriptorium/ds_meta.rb', line 9

def holding
  @holding
end

#manuscriptObject (readonly)

Returns the value of attribute manuscript.



9
10
11
# File 'lib/digital_scriptorium/ds_meta.rb', line 9

def manuscript
  @manuscript
end

#recordObject (readonly)

Returns the value of attribute record.



9
10
11
# File 'lib/digital_scriptorium/ds_meta.rb', line 9

def record
  @record
end

Instance Method Details

#current_holdings(manuscript, export_hash) ⇒ Object



24
25
26
# File 'lib/digital_scriptorium/ds_meta.rb', line 24

def current_holdings(manuscript, export_hash)
  manuscript.holding_ids.filter_map { |id| export_hash[id] if export_hash[id]&.current? }
end