Sha256: a0a11edcfcc1c984e0ae756df75567b3258aac31d0956280b1e8666dec8673e5

Contents?: true

Size: 703 Bytes

Versions: 1

Compression:

Stored size: 703 Bytes

Contents

module InstDataShipper
  class BasicDumper < Dumper
    def self.perform_dump(destinations:, schema:, &block)
      raise "Schema must be a constantizable string" unless schema.is_a?(String)

      dumper = new(destinations)
      dumper.instance_variable_set(:@schema_pointer, schema)
      dumper.instance_variable_set(:@body_block, block)
      dumper.begin_dump

      dumper.tracker
    end

    hook :initialize_dump_batch do |context|
      context[:schema_pointer] = @schema_pointer
    end

    def enqueue_tasks
      instance_exec(&@body_block)
    end

    def table_schemas
      pointer = @schema_pointer || batch_context[:schema_pointer]
      safe_constantize(pointer)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
inst_data_shipper-0.1.0.beta1 lib/inst_data_shipper/basic_dumper.rb