class DRbQS::Transfer::FileList

Public Class Methods

new(*files) click to toggle source

Initialization is executed on server. If :readonly option is true, nodes on same computer as server does not copy files. Therefore, if we edit the files then the change remains. If :readonly option is not true then the files is copied, so the original files are not changed.

# File lib/drbqs/utility/transfer/transfer_file_list.rb, line 11
def initialize(*files)
  opts = (Hash === files[-1] ? files.pop : {})
  @readonly = opts[:readonly]
  @files = files.map do |path|
    epath = File.expand_path(path)
    unless File.exist?(epath)
      raise ArgumentError, "#{epath} does not exist."
    end
    epath
  end
  @downloaded = nil
  @path = nil
end

Public Instance Methods

path() click to toggle source

Return an array of paths of downloaded files. Note that this method is executed on a node.

# File lib/drbqs/utility/transfer/transfer_file_list.rb, line 34
def path
  download unless @downloaded
  @path
end

Private Instance Methods

download() click to toggle source

This method is executed on a node.

# File lib/drbqs/utility/transfer/transfer_file_list.rb, line 26
def download
  @downloaded = true
  @path = DRbQS::Transfer::Client.get.download(@files, @readonly)
end