Sha256: 0ac1991e5e57655b93f497addaa8293549e00767c1a5b750a29e52b62dafa288

Contents?: true

Size: 1.03 KB

Versions: 2

Compression:

Stored size: 1.03 KB

Contents

require 'chrysalis/ar/tar'


module Chrysalis
module Ar

  # Implements support for extracting tar archives compressed with gzip
  # compression.
  #
  # Archives of this type are identified by the file extension <em>.tar.gz</em>.
  class TarGzArchive < TarArchive
    
    EXTENSION = ".tar.gz".freeze
    
    def self.extracts?(path)
      path.end? EXTENSION
    end
    
    protected
      def flags
        "xzvf"
      end
      
      def extracts_into
        return @extracts_into if @extracts_into
        Pathname.new(@path).basename(EXTENSION)
      end
    
  end
  
  
  # Implements support for extracting tar archives compressed with gzip
  # compression.
  #
  # Archives of this type are identified by the file extension <em>.tgz</em>.
  class TgzArchive < TarGzArchive
    EXTENSION = ".tgz".freeze
    
    def self.extracts?(path)
      path.end? EXTENSION
    end
    
    protected
      def extracts_into
        return @extracts_into if @extracts_into
        Pathname.new(@path).basename(EXTENSION)
      end
  end

end 
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
chrysalis-0.1.0 lib/chrysalis/ar/tar_gz.rb
chrysalis-0.1.1 lib/chrysalis/ar/tar_gz.rb