Class: Rmega::Nodes::Folder

Inherits:
Node
  • Object
show all
Includes:
Deletable, Expandable, Traversable
Defined in:
lib/rmega/nodes/folder.rb

Instance Attribute Summary

Attributes inherited from Node

#data, #session

Instance Method Summary collapse

Methods included from Deletable

#delete, #trash

Methods included from Traversable

#children, #empty?, #files, #folders, #parent

Methods included from Expandable

#create_folder, #upload_url

Methods included from Uploadable

#encrypt_chunck, #read_chunk, #upload, #upload_chunk

Methods inherited from Node

#attributes, #decrypted_file_key, #file_key, #file_keys, #handle, #initialize, #name, #parent_handle, #process_shared_key, #public_handle, #public_url, #public_url=, #shared_root?, #type

Methods included from Loggable

#logger

Constructor Details

This class inherits a constructor from Rmega::Nodes::Node

Instance Method Details

#download(path) ⇒ Object


15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/rmega/nodes/folder.rb', line 15

def download(path)
  children.each do |node|
    if node.type == :file
      node.download path
    elsif node.type == :folder
      subfolder = ::File.expand_path ::File.join(path, node.name)
      Dir.mkdir(subfolder) unless Dir.exists?(subfolder)
      node.download subfolder
    end
  end

  nil
end