Class: Arclight::Parents

Inherits:
Object
  • Object
show all
Defined in:
app/models/arclight/parents.rb

Overview

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ids:, labels:, eadid:) ⇒ Parents

Returns a new instance of Parents.



9
10
11
12
13
# File 'app/models/arclight/parents.rb', line 9

def initialize(ids:, labels:, eadid:)
  @ids = ids
  @labels = labels
  @eadid = eadid
end

Instance Attribute Details

#idsObject (readonly)

Returns the value of attribute ids.



8
9
10
# File 'app/models/arclight/parents.rb', line 8

def ids
  @ids
end

#labelsObject (readonly)

Returns the value of attribute labels.



8
9
10
# File 'app/models/arclight/parents.rb', line 8

def labels
  @labels
end

Class Method Details

.from_solr_document(document) ⇒ Object

Parameters:



27
28
29
30
31
32
# File 'app/models/arclight/parents.rb', line 27

def self.from_solr_document(document)
  ids = document.parent_ids
  labels = document.parent_labels
  eadid = document.eadid
  new(ids: ids, labels: labels, eadid: eadid)
end

Instance Method Details

#as_parentsArray[Arclight::Parent]

Returns:



21
22
23
# File 'app/models/arclight/parents.rb', line 21

def as_parents
  Hash[ids.zip(labels)].map { |k, v| Arclight::Parent.new(id: k, label: v, eadid: eadid) }
end

#eadidObject



15
16
17
# File 'app/models/arclight/parents.rb', line 15

def eadid
  Arclight::NormalizedId.new(@eadid).to_s
end