Sha256: c93c6a07477cd0afb201ab7f032772d556fe71c152efbbdcaa50538afbf13c1e

Contents?: true

Size: 697 Bytes

Versions: 1

Compression:

Stored size: 697 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]
      pointer.constantize
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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