Sha256: b4ae161b19ccb98f492a88fc4003e4b62b68d33b3fa6e533cdedb12405a5a29e

Contents?: true

Size: 702 Bytes

Versions: 8

Compression:

Stored size: 702 Bytes

Contents

require 'rmega/crypto/crypto'
require 'rmega/utils'
require 'rmega/nodes/node'
require 'rmega/nodes/expandable'
require 'rmega/nodes/traversable'
require 'rmega/nodes/deletable'

module Rmega
  module Nodes
    class Folder < Node
      include Expandable
      include Traversable
      include Deletable

      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
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
rmega-0.1.7 lib/rmega/nodes/folder.rb
rmega-0.1.6 lib/rmega/nodes/folder.rb
rmega-0.1.5 lib/rmega/nodes/folder.rb
rmega-0.1.4 lib/rmega/nodes/folder.rb
rmega-0.1.3 lib/rmega/nodes/folder.rb
rmega-0.1.2 lib/rmega/nodes/folder.rb
rmega-0.1.1 lib/rmega/nodes/folder.rb
rmega-0.1.0 lib/rmega/nodes/folder.rb