Class: Hbc::Container::Gzip

Inherits:
Base
  • Object
show all
Defined in:
Library/Homebrew/cask/lib/hbc/container/gzip.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#extract_nested_container, #extract_nested_inside, #initialize, #verbose?

Constructor Details

This class inherits a constructor from Hbc::Container::Base

Class Method Details

.me?(criteria) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
# File 'Library/Homebrew/cask/lib/hbc/container/gzip.rb', line 8

def self.me?(criteria)
  criteria.magic_number(/^\037\213/n)
end

Instance Method Details

#extractObject



12
13
14
15
16
17
18
19
# File 'Library/Homebrew/cask/lib/hbc/container/gzip.rb', line 12

def extract
  Dir.mktmpdir do |unpack_dir|
    @command.run!("/usr/bin/ditto",  args: ["--", @path, unpack_dir])
    @command.run!("/usr/bin/gunzip", args: ["--quiet", "--name", "--", Pathname.new(unpack_dir).join(@path.basename)])

    extract_nested_inside(unpack_dir)
  end
end