Sha256: 36acf15643e69af0f9d1b442c445f0e9ff0165164cca9d38eedca540bb126a7a

Contents?: true

Size: 817 Bytes

Versions: 2

Compression:

Stored size: 817 Bytes

Contents

require 'fileutils'

class CreateFile
  def initialize(n)
    @n = n
  end

  def output_to_file
    path = "/tmp/transfer_test_#{@n.to_s}.txt"
    open(path, 'w') { |f| f.puts "file#{@n.to_s}" }
    path
  end

  def create
    DRbQS::FileTransfer.enqueue(output_to_file)
    nil
  end

  def create_compress
    DRbQS::FileTransfer.compress_enqueue(output_to_file)
    nil
  end
end

class CreateDirectory
  def initialize(n)
    @n = n
  end

  def output_to_directory
    path = "/tmp/transfer_test_#{@n.to_s}/"
    FileUtils.mkdir_p(path)
    open(File.join(path, 'tmp.txt'), 'w') { |f| f.puts "file#{@n.to_s}" }
    path
  end

  def create
    DRbQS::FileTransfer.enqueue(output_to_directory)
    nil
  end

  def create_compress
    DRbQS::FileTransfer.compress_enqueue(output_to_directory)
    nil
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
drbqs-0.0.10 example/transfer/file.rb
drbqs-0.0.9 example/transfer/file.rb