Module: Kiba::Extend::Mixins::IterativeCleanup::Jobs::Worksheet
- Defined in:
- lib/kiba/extend/mixins/iterative_cleanup/jobs/worksheet.rb
Overview
Class Method Summary collapse
Class Method Details
.get_xforms(mod) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/kiba/extend/mixins/iterative_cleanup/jobs/worksheet.rb', line 21 def get_xforms(mod) base = [] if mod.respond_to?(:worksheet_pre_xforms) base << mod.worksheet_pre_xforms end base << xforms(mod) if mod.respond_to?(:worksheet_post_xforms) base << mod.worksheet_post_xforms end base end |
.job(mod:) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/kiba/extend/mixins/iterative_cleanup/jobs/worksheet.rb', line 11 def job(mod:) Kiba::Extend::Jobs::Job.new( files: { source: mod.cleaned_uniq_job_key, destination: mod.worksheet_job_key }, transformer: get_xforms(mod) ) end |
.xforms(mod) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/kiba/extend/mixins/iterative_cleanup/jobs/worksheet.rb', line 33 def xforms(mod) Kiba.job_segment do unless mod.provided_worksheets.empty? # rubocop:disable Layout/LineLength known_vals = Kiba::Extend::Mixins::IterativeCleanup::KnownWorksheetValues.new( mod ).call # rubocop:enable Layout/LineLength transform Append::NilFields, fields: :to_review transform do |row| ids = row[mod.collated_orig_values_id_field] next row if ids.blank? known = ids.split(mod.collation_delim) .map { |id| known_vals.include?(id) } .all? next row if known row[:to_review] = "y" row end end end end |