Module: Kiba::Extend::Mixins::IterativeCleanup::Jobs::ReturnedCompiled

Defined in:
lib/kiba/extend/mixins/iterative_cleanup/jobs/returned_compiled.rb

Overview

Since:

  • 4.0.0

Class Method Summary collapse

Class Method Details

.get_xforms(mod) ⇒ Object

Since:

  • 4.0.0



21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/kiba/extend/mixins/iterative_cleanup/jobs/returned_compiled.rb', line 21

def get_xforms(mod)
  base = []
  if mod.respond_to?(:returned_compiled_pre_xforms)
    base << mod.returned_compiled_pre_xforms
  end

  base << xforms(mod)

  if mod.respond_to?(:returned_compiled_post_xforms)
    base << mod.returned_compiled_post_xforms
  end
  base
end

.job(mod:) ⇒ Object

Since:

  • 4.0.0



11
12
13
14
15
16
17
18
19
# File 'lib/kiba/extend/mixins/iterative_cleanup/jobs/returned_compiled.rb', line 11

def job(mod:)
  Kiba::Extend::Jobs::Job.new(
    files: {
      source: mod.returned_file_jobs,
      destination: mod.returned_compiled_job_key
    },
    transformer: get_xforms(mod)
  )
end

.xforms(mod) ⇒ Object

Since:

  • 4.0.0



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/kiba/extend/mixins/iterative_cleanup/jobs/returned_compiled.rb', line 35

def xforms(mod)
  Kiba.job_segment do
    transform Delete::Fields,
      fields: :to_review

    if mod.clean_fingerprint_flag_ignore_fields
      transform Fingerprint::FlagChanged,
        fingerprint: :clean_fingerprint,
        source_fields: mod.fingerprint_fields,
        delete_fp: true,
        target: :corrected,
        ignore_fields: mod.clean_fingerprint_flag_ignore_fields
    else
      transform Fingerprint::FlagChanged,
        fingerprint: :clean_fingerprint,
        source_fields: mod.fingerprint_fields,
        delete_fp: true,
        target: :corrected
    end

    transform Delete::FieldnamesStartingWith,
      prefix: "fp_"
    transform Clean::EnsureConsistentFields
  end
end