Class: DorIndexing::Builders::AuthorBuilder
- Inherits:
-
Object
- Object
- DorIndexing::Builders::AuthorBuilder
- Defined in:
- lib/dor_indexing/builders/author_builder.rb
Overview
Builds the author fields for a solr document
Instance Method Summary collapse
- #build_all ⇒ Object
- #build_primary ⇒ Object
-
#initialize(cocina_contributors) ⇒ AuthorBuilder
constructor
A new instance of AuthorBuilder.
Constructor Details
#initialize(cocina_contributors) ⇒ AuthorBuilder
Returns a new instance of AuthorBuilder.
7 8 9 |
# File 'lib/dor_indexing/builders/author_builder.rb', line 7 def initialize(cocina_contributors) @cocina_contributors = Array(cocina_contributors) end |
Instance Method Details
#build_all ⇒ Object
18 19 20 |
# File 'lib/dor_indexing/builders/author_builder.rb', line 18 def build_all NameBuilder.build_all(cocina_contributors.filter_map(&:name)) end |
#build_primary ⇒ Object
11 12 13 14 15 16 |
# File 'lib/dor_indexing/builders/author_builder.rb', line 11 def build_primary contributor = primary_cocina_contributor || cocina_contributors.first return unless contributor NameBuilder.build_primary_name(contributor.name) if contributor end |