Class: DRbQS::Transfer::FileList

Inherits:
Object
  • Object
show all
Defined in:
lib/drbqs/utility/transfer/transfer_file_list.rb

Instance Method Summary collapse

Constructor Details

#initialize(*files) ⇒ FileList

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.



11
12
13
14
15
16
17
18
19
20
21
22
23
# 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

Instance Method Details

#pathObject

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



34
35
36
37
# File 'lib/drbqs/utility/transfer/transfer_file_list.rb', line 34

def path
  download unless @downloaded
  @path
end