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:, levels:) ⇒ Parents

Returns a new instance of Parents.



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

def initialize(ids:, labels:, eadid:, levels:)
  @ids = ids
  @labels = labels
  @eadid = eadid
  @levels = levels
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

#levelsObject (readonly)

Returns the value of attribute levels.



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

def levels
  @levels
end

Class Method Details

.from_solr_document(document) ⇒ Object

Parameters:



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

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

Instance Method Details

#as_parentsArray[Arclight::Parent]

Returns:



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

def as_parents
  ids.map.with_index { |_id, idx| Arclight::Parent.new(id: ids[idx], label: labels[idx], eadid: eadid, level: levels[idx]) }
end

#eadidObject



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

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