Class: DorIndexing::Builders::TemporalBuilder
- Inherits:
-
Object
- Object
- DorIndexing::Builders::TemporalBuilder
- Defined in:
- lib/dor_indexing/builders/temporal_builder.rb
Overview
Builds the temporal fields for a solr document
Class Method Summary collapse
-
.build(subjects) ⇒ Array<String>
The temporal values for Solr.
Instance Method Summary collapse
- #build ⇒ Object
-
#extract_temporal_from_subjects(local_subjects) ⇒ Object
rubocop:disable Metrics/AbcSize.
-
#initialize(subjects) ⇒ TemporalBuilder
constructor
A new instance of TemporalBuilder.
Constructor Details
#initialize(subjects) ⇒ TemporalBuilder
Returns a new instance of TemporalBuilder.
13 14 15 |
# File 'lib/dor_indexing/builders/temporal_builder.rb', line 13 def initialize(subjects) @subjects = Array(subjects) end |
Class Method Details
.build(subjects) ⇒ Array<String>
Returns the temporal values for Solr.
9 10 11 |
# File 'lib/dor_indexing/builders/temporal_builder.rb', line 9 def self.build(subjects) new(subjects).build end |
Instance Method Details
#build ⇒ Object
17 18 19 |
# File 'lib/dor_indexing/builders/temporal_builder.rb', line 17 def build extract_temporal_from_subjects(subjects) end |
#extract_temporal_from_subjects(local_subjects) ⇒ Object
rubocop:disable Metrics/AbcSize
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/dor_indexing/builders/temporal_builder.rb', line 22 def extract_temporal_from_subjects(local_subjects) ( build_temporal_nodes(local_subjects.select { |node| node.type == 'time' }) + local_subjects.reject(&:type).flat_map do |subject| next extract_temporal_from_subjects(subject.parallelValue) if subject.parallelValue.present? build_temporal_nodes(Array(subject.structuredValue).select { |node| node.type == 'time' }) end ).uniq end |