Skip to content

Commit

Permalink
multival Replace::FieldValueWithStaticMapping does not croak on nil
Browse files Browse the repository at this point in the history
  • Loading branch information
kspurgin committed Nov 2, 2020
1 parent 246e7f8 commit 1df984f
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 1df984f

Please sign in to comment.