Class: ZipDir::Dir::Proxy

Inherits:
Object
  • Object
show all
Defined in:
lib/zip_dir/dir.rb

Instance Method Summary collapse

Constructor Details

#initialize(copy_path) ⇒ Proxy

Returns a new instance of Proxy.



33
34
35
# File 'lib/zip_dir/dir.rb', line 33

def initialize(copy_path)
  @copy_path = copy_path
end

Instance Method Details

#add_path(source_path, options = {}) ⇒ Object Also known as: <<



37
38
39
40
41
42
43
44
45
46
47
# File 'lib/zip_dir/dir.rb', line 37

def add_path(source_path, options={})
  options = options.inject({}){|hash,(k,v)| hash[k.to_sym] = v; hash}

  if File.directory?(source_path)
    add_directory source_path, options
  elsif File.file?(source_path)
    add_simple_path source_path, options
  else
    raise "Attempting to add non-existent path: #{source_path}"
  end
end