From 1df984fa8a05c2d2470202e37484a4783c3f1d81 Mon Sep 17 00:00:00 2001 From: Kristina Spurgin Date: Mon, 2 Nov 2020 18:08:55 -0500 Subject: [PATCH] multival Replace::FieldValueWithStaticMapping does not croak on nil --- lib/kiba/extend/transforms/replace.rb | 7 ++++++- lib/kiba/extend/version.rb | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/kiba/extend/transforms/replace.rb b/lib/kiba/extend/transforms/replace.rb index eb885249d..8d0534447 100644 --- a/lib/kiba/extend/transforms/replace.rb +++ b/lib/kiba/extend/transforms/replace.rb @@ -33,7 +33,12 @@ def initialize(source:, target:, mapping:, fallback_val: :orig, delete_source: t end def process(row) - origval = @multival ? row.fetch(@source).split(@sep) : [row.fetch(@source)] + rowval = row.fetch(@source, nil) + if rowval.nil? + origval = [rowval] + else + origval = @multival ? row.fetch(@source).split(@sep) : [row.fetch(@source)] + end newvals = [] origval.each do |oval| diff --git a/lib/kiba/extend/version.rb b/lib/kiba/extend/version.rb index b0793aeda..ab3206370 100644 --- a/lib/kiba/extend/version.rb +++ b/lib/kiba/extend/version.rb @@ -1,5 +1,5 @@ module Kiba module Extend - VERSION = "1.4.0" + VERSION = "1.4.1" end end