Class: PgExport::CompressedDump

Inherits:
Dump::Base show all
Defined in:
lib/pg_export/entities/compressed_dump.rb

Constant Summary

Constants inherited from Dump::Base

Dump::Base::CHUNK_SIZE

Instance Method Summary collapse

Methods inherited from Dump::Base

#initialize, #read_chunk, #to_s

Methods included from Dump::SizeHuman

#size_human

Constructor Details

This class inherits a constructor from PgExport::Dump::Base

Instance Method Details

#extObject



7
8
9
# File 'lib/pg_export/entities/compressed_dump.rb', line 7

def ext
  '.gz'
end

#nameObject



3
4
5
# File 'lib/pg_export/entities/compressed_dump.rb', line 3

def name
  'Compressed Dump'
end

#open(operation_type, &block) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/pg_export/entities/compressed_dump.rb', line 11

def open(operation_type, &block)
  case operation_type.to_sym
    when :read then Zlib::GzipReader.open(path, &block)
    when :write then Zlib::GzipWriter.open(path, &block)
    else raise ArgumentError, 'Operation type can be only :read or :write'
  end
end