Sha256: 31b8e11bd36c59d2ab7d9da3cafa073e1a3a4e2734bccb95e5af64fb11faef26
Contents?: true
Size: 616 Bytes
Versions: 3
Compression:
Stored size: 616 Bytes
Contents
class PgExport class FtpService CHUNK_SIZE = (2**16).freeze def initialize(params) @host = params.fetch(:host) connection = Connection.new(params) @ftp = connection.ftp ObjectSpace.define_finalizer(self, proc { connection.close }) end def list(regexp) ftp.list(regexp).map { |item| item.split(' ').last }.sort.reverse end def delete(filename) ftp.delete(filename) end def upload_file(path, name) ftp.putbinaryfile(path.to_s, name, CHUNK_SIZE) end def to_s host end private attr_reader :ftp, :host end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
pg_export-0.3.2 | lib/pg_export/services/ftp_service.rb |
pg_export-0.3.1 | lib/pg_export/services/ftp_service.rb |
pg_export-0.3.0 | lib/pg_export/services/ftp_service.rb |