Sha256: c7c13e632e52b248c3466d7516d7079abf5765e3ba2ef40a12178a2693290dcb

Contents?: true

Size: 789 Bytes

Versions: 13

Compression:

Stored size: 789 Bytes

Contents

module Backup
  module Compressor
    class Bzip2 < Base
      ##
      # Specify the level of compression to use.
      #
      # Values should be a single digit from 1 to 9.
      # Note that setting the level to either extreme may or may not
      # give the desired result. Be sure to check the documentation
      # for the compressor being used.
      #
      # The default `level` is 9.
      attr_accessor :level

      ##
      # Creates a new instance of Backup::Compressor::Bzip2
      def initialize(&block)
        load_defaults!

        @level ||= false

        instance_eval(&block) if block_given?

        @cmd = "#{utility(:bzip2)}#{options}"
        @ext = ".bz2"
      end

      private

      def options
        " -#{@level}" if @level
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 4 rubygems

Version Path
backup-5.0.0.beta.3 lib/backup/compressor/bzip2.rb
backedup-5.0.0.beta.5 lib/backup/compressor/bzip2.rb
backedup-5.0.0.beta.4 lib/backup/compressor/bzip2.rb
backedup-5.0.0.beta.3 lib/backup/compressor/bzip2.rb
ext_backup-5.0.0.beta.2.1 lib/backup/compressor/bzip2.rb
ext_backup-5.0.0.beta.2.ext.0.1.2 lib/backup/compressor/bzip2.rb
ext_backup-5.0.0.beta.2.ext.0.1.1 lib/backup/compressor/bzip2.rb
ext_backup-5.0.0.beta.2.ext.0.1.0 lib/backup/compressor/bzip2.rb
backup-5.0.0.beta.2 lib/backup/compressor/bzip2.rb
backup-5.0.0.beta.1 lib/backup/compressor/bzip2.rb
backup-bouchard-4.4.4 lib/backup/compressor/bzip2.rb
backup-bouchard-4.4.2 lib/backup/compressor/bzip2.rb
backup-bouchard-4.4.1 lib/backup/compressor/bzip2.rb