Class: Krikri::Enrichments::RemoveEmptyFields

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

Overview

Enrichment to strip empty strings from a value

empty = RemoveEmptyFields.new
empty.enrich_value('moomin')
# => 'moomin'
empty.enrich_value('')
# => nil

Constant Summary

Constants included from SoftwareAgent

SoftwareAgent::Logger

Instance Method Summary collapse

Methods included from FieldEnrichment

#enrich, #enrich_all, #enrich_field

Methods included from Krikri::Enrichment

#enrich, #enrich!, #list_fields

Methods included from SoftwareAgent

#agent_name, #log, #run

Instance Method Details

#enrich_value(value) ⇒ Object


13
14
15
# File 'lib/krikri/enrichments/remove_empty_fields.rb', line 13

def enrich_value(value)
  (value.is_a?(String) && empty?(value)) ? nil : value
end