Class: Krikri::Enrichments::DcmiEnforcer

Inherits:
Object
  • Object
show all
Includes:
FieldEnrichment
Defined in:
lib/krikri/enrichments/dcmi_enforcer.rb

Overview

Removes non-DCMI Type values from a field

Instance Method Summary collapse

Methods included from FieldEnrichment

#enrich, #enrich_all, #enrich_field

Methods included from Krikri::Enrichment

#enrich, #enrich!, #list_fields

Instance Method Details

#enrich_value(value) ⇒ DPLA::MAP::Controlled::DCMIType?

Returns the original value or ‘nil`.

Parameters:

  • value (Object)

    the value to enrich

Returns:

  • (DPLA::MAP::Controlled::DCMIType, nil)

    the original value or ‘nil`



11
12
13
14
15
# File 'lib/krikri/enrichments/dcmi_enforcer.rb', line 11

def enrich_value(value)
  return nil unless value.is_a? DPLA::MAP::Controlled::DCMIType
  return nil unless value.valid?
  value
end