Class: Cocina::Models::Mapping::FromMods::PartBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/cocina/models/mapping/from_mods/part_builder.rb

Overview

Maps parts

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(part_element:) ⇒ PartBuilder

Returns a new instance of PartBuilder.



15
16
17
# File 'lib/cocina/models/mapping/from_mods/part_builder.rb', line 15

def initialize(part_element:)
  @part_element = part_element
end

Class Method Details

.build(part_element:) ⇒ Hash

Returns a hash that can be mapped to a cocina model.

Parameters:

  • part_element (Nokogiri::XML::Element)

Returns:

  • (Hash)

    a hash that can be mapped to a cocina model



11
12
13
# File 'lib/cocina/models/mapping/from_mods/part_builder.rb', line 11

def self.build(part_element:)
  new(part_element: part_element).build
end

Instance Method Details

#buildObject



19
20
21
# File 'lib/cocina/models/mapping/from_mods/part_builder.rb', line 19

def build
  structured_value? ? structured_value : grouped_value
end