Class/Module Index [+]

Quicksearch

Selenium::WebDriver::Zipper

Constants

EXTENSIONS

Public Class Methods

unzip(path) click to toggle source
# File lib/selenium/webdriver/common/zipper.rb, line 13
def unzip(path)
  destination = Dir.mktmpdir("unzip")
  FileReaper << destination

  Zip::ZipFile.open(path) do |zip|
    zip.each do |entry|
      to      = File.join(destination, entry.name)
      dirname = File.dirname(to)

      FileUtils.mkdir_p dirname unless File.exist? dirname
      zip.extract(entry, to)
    end
  end

  destination
end
zip(path) click to toggle source
# File lib/selenium/webdriver/common/zipper.rb, line 30
def zip(path)
  with_tmp_zip do |zip|
    ::Find.find(path) do |file|
      unless File.directory?(file)
        add_zip_entry zip, file, file.sub("#{path}/", '')
      end
    end

    zip.commit
    File.open(zip.name, "rb") { |io| Base64.strict_encode64 io.read }
  end
end
zip_file(path) click to toggle source
# File lib/selenium/webdriver/common/zipper.rb, line 43
def zip_file(path)
  with_tmp_zip do |zip|
    add_zip_entry zip, path, File.basename(path)

    zip.commit
    File.open(zip.name, "rb") { |io| Base64.strict_encode64 io.read }
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.