Skip to content

Commit

Permalink
Merge pull request #6 from lyrasis/bugfix
Browse files Browse the repository at this point in the history
multival Replace::FieldValueWithStaticMapping does not croak on nil
  • Loading branch information
kspurgin authored Nov 2, 2020
2 parents 246e7f8 + 1df984f commit a455f95
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion lib/kiba/extend/transforms/replace.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand Down
2 changes: 1 addition & 1 deletion lib/kiba/extend/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Kiba
module Extend
VERSION = "1.4.0"
VERSION = "1.4.1"
end
end

0 comments on commit a455f95

Please sign in to comment.