Module: Arclight::SharedTerminologyBehavior

Included in:
CustomComponent, CustomDocument
Defined in:
lib/arclight/shared_terminology_behavior.rb

Overview

An extendable mixin intended to share terminology behavior between the CustomDocument and CustomComponent classes

Instance Method Summary collapse

Instance Method Details

#add_dates(t, prefix) ⇒ Object

date indexing



17
18
19
20
21
22
23
# File 'lib/arclight/shared_terminology_behavior.rb', line 17

def add_dates(t, prefix)
  t.normal_unit_dates(path: prefix + 'did/unitdate/@normal')
  t.unitdate_bulk(path: prefix + 'did/unitdate[@type=\'bulk\']', index_as: %i[displayable])
  t.unitdate_inclusive(path: prefix + 'did/unitdate[@type=\'inclusive\']', index_as: %i[displayable])
  t.unitdate_other(path: prefix + 'did/unitdate[not(@type)]', index_as: %i[displayable])
  t.unitdate(path: prefix + 'did/unitdate', index_as: %i[displayable])
end

#add_extent(t, prefix) ⇒ Object



12
13
14
# File 'lib/arclight/shared_terminology_behavior.rb', line 12

def add_extent(t, prefix)
  t.extent(path: prefix + 'did/physdesc/extent', index_as: %i[displayable searchable])
end

#add_searchable_notes(t, prefix) ⇒ Object

rubocop: disable Metrics/MethodLength



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/arclight/shared_terminology_behavior.rb', line 25

def add_searchable_notes(t, prefix) # rubocop: disable Metrics/MethodLength
  # various searchable notes
  %i[
    accessrestrict
    accruals
    acqinfo
    altformavail
    appraisal
    arrangement
    bibliography
    bioghist
    custodhist
    fileplan
    note
    odd
    originalsloc
    otherfindaid
    phystech
    prefercite
    processinfo
    relatedmaterial
    scopecontent
    separatedmaterial
    userestrict
  ].each do |k|
    # many of the notes support various markup so we want everything but the heading
    t.send(k, path: "#{prefix}#{k}/*[local-name()!=\"head\"]", index_as: %i[displayable searchable])
  end

  # various searchable notes in the did
  %i[
    abstract
    materialspec
    physloc
  ].each do |k|
    t.send(k, path: "#{prefix}did/#{k}", index_as: %i[displayable searchable])
  end
  t.did_note(path: "#{prefix}did/note", index_as: %i[displayable searchable]) # conflicts with top-level note
end

#add_unitid(t, prefix) ⇒ Object



8
9
10
# File 'lib/arclight/shared_terminology_behavior.rb', line 8

def add_unitid(t, prefix)
  t.unitid(path: prefix + 'did/unitid', index_as: %i[displayable searchable])
end