Sha256: 7584610a3f448755c0b214c0e11171e759b19b6041cc872b4fb24d139f7a5bd3

Contents?: true

Size: 816 Bytes

Versions: 56

Compression:

Stored size: 816 Bytes

Contents

# encoding: utf-8

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

56 entries across 56 versions & 7 rubygems

Version Path
backup-4.1.3 lib/backup/compressor/bzip2.rb
venet-backup-4.1.3 lib/backup/compressor/bzip2.rb
backup-4.1.2 lib/backup/compressor/bzip2.rb
backup-4.1.1 lib/backup/compressor/bzip2.rb
backup-4.1.0 lib/backup/compressor/bzip2.rb
backup-4.0.7 lib/backup/compressor/bzip2.rb
backup-4.0.6 lib/backup/compressor/bzip2.rb
backup-4.0.5 lib/backup/compressor/bzip2.rb
backup-4.0.4 lib/backup/compressor/bzip2.rb
backup_zh-4.0.3.1 lib/backup/compressor/bzip2.rb
backup-4.0.3 lib/backup/compressor/bzip2.rb
backup-4.0.2 lib/backup/compressor/bzip2.rb
nfm-backup-4.0.1a lib/backup/compressor/bzip2.rb
backup-4.0.1 lib/backup/compressor/bzip2.rb
backup-4.0.0 lib/backup/compressor/bzip2.rb
backup-4.0.0rc1 lib/backup/compressor/bzip2.rb