Class: Furoshiki::Zip::DirectoryContents

Inherits:
Object
  • Object
show all
Defined in:
lib/furoshiki/zip/directory_contents.rb

Instance Method Summary collapse

Constructor Details

#initialize(input_dir, output_file) ⇒ DirectoryContents

Returns a new instance of DirectoryContents.

Parameters:

  • input_dir (#to_s)

    the directory to zip

  • output_file (#to_s)

    the location of the output archive



8
9
10
11
# File 'lib/furoshiki/zip/directory_contents.rb', line 8

def initialize(input_dir, output_file)
  @input_dir = Pathname.new(input_dir)
  @zip = Recursive.new(output_file)
end

Instance Method Details

#writeObject

Zip the contents of the input directory, without the root.



14
15
16
17
# File 'lib/furoshiki/zip/directory_contents.rb', line 14

def write
  entries = @input_dir.children(false)
  @zip.write entries, @input_dir, ''
end