Sha256: d5afd83dabf604c882bfa9f92881571cc04d2acb09be5091a791ecbb913aeb9c

Contents?: true

Size: 820 Bytes

Versions: 2

Compression:

Stored size: 820 Bytes

Contents

# frozen_string_literal: true

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

2 entries across 2 versions & 1 rubygems

Version Path
backupii-0.1.0.pre.alpha.2 lib/backup/compressor/bzip2.rb
backupii-0.1.0.pre.alpha.1 lib/backup/compressor/bzip2.rb