Class: Hbc::Container::Bzip2

Inherits:
Base
  • Object
show all
Defined in:
Library/Homebrew/cask/lib/hbc/container/bzip2.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/bzip2.rb', line 8

def self.me?(criteria)
  criteria.magic_number(/^BZh/n)
end

Instance Method Details

#extractObject



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

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

    extract_nested_inside(unpack_dir)
  end
end