Class: Lt::Lcms::Metadata::Service
- Inherits:
-
BaseService
- Object
- BaseService
- Lt::Lcms::Metadata::Service
- Defined in:
- lib/lt/lcms/metadata/service.rb
Class Method Summary collapse
- .agenda ⇒ Object
- .foundational_metadata ⇒ Object
- .materials_metadata ⇒ Object
- .options_for(context) ⇒ Object
-
.parse(content, *args) ⇒ Object
rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity.
Class Method Details
.agenda ⇒ Object
9 10 11 |
# File 'lib/lt/lcms/metadata/service.rb', line 9 def agenda @agenda.data.presence || [] end |
.foundational_metadata ⇒ Object
13 14 15 |
# File 'lib/lt/lcms/metadata/service.rb', line 13 def @foundational_metadata.data.presence || {} end |
.materials_metadata ⇒ Object
17 18 19 |
# File 'lib/lt/lcms/metadata/service.rb', line 17 def DocTemplate::Objects::MaterialMetadata end |
.options_for(context) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/lt/lcms/metadata/service.rb', line 21 def (context) super.merge( if material? { metadata: DocTemplate::Objects::MaterialMetadata.build_from(.data), material: true } else { foundational_metadata: DocTemplate::Objects::BaseMetadata.build_from(@foundational_metadata.data), metadata: DocTemplate::Objects::BaseMetadata.build_from(.data), parts: @target_table.try(:parts) } end ) end |
.parse(content, *args) ⇒ Object
rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/lt/lcms/metadata/service.rb', line 38 def parse(content, *args) # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity super if material? @metadata = DocTemplate::Tables::MaterialMetadata.parse content @errors.concat @metadata.errors raise ::Lcms::Engine::MaterialError, 'No metadata present' \ if !@metadata&.table_exist? || @metadata&.data&.empty? else @metadata = DocTemplate::Tables::Metadata.parse content @errors.concat @metadata.errors raise ::Lcms::Engine::DocumentError, 'No metadata present' unless @metadata&.table_exist? @agenda = DocTemplate::Tables::Agenda.parse content @section_metadata = DocTemplate::Tables::Section.parse content, force_inject_section: force_inject_section? @activity_metadata = DocTemplate::Tables::Activity.parse content, template_type: template_type @target_table = DocTemplate::Tables::Target.parse(content) if target_table? @foundational_metadata = if foundational? @metadata else DocTemplate::Tables::FoundationalMetadata.parse content end end self end |