Sha256: 8d51a0602bf298c792fb5a1fe494a95f6d0b2beefef7c59a9ed88f2e5e9593a3

Contents?: true

Size: 752 Bytes

Versions: 4

Compression:

Stored size: 752 Bytes

Contents

module InstDataShipper
  class BasicDumper < Dumper
    def self.perform_dump(destinations:, schema:, force_full_tables: nil, &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(force_full_tables: force_full_tables)

      dumper.tracker
    end

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

    def enqueue_tasks
      instance_exec(&@body_block)
    end

    def schema
      pointer = @schema_pointer || batch_context[:schema_pointer]
      pointer.constantize
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
inst_data_shipper-0.2.6 lib/inst_data_shipper/basic_dumper.rb
inst_data_shipper-0.2.5 lib/inst_data_shipper/basic_dumper.rb
inst_data_shipper-0.2.4 lib/inst_data_shipper/basic_dumper.rb
inst_data_shipper-0.2.3 lib/inst_data_shipper/basic_dumper.rb