Sha256: fdc0d099244cdd847e5ed5a429f74bab8f99263e7b933a2ac3895f16a6af12a8

Contents?: true

Size: 1.19 KB

Versions: 26

Compression:

Stored size: 1.19 KB

Contents

# encoding: utf-8

module Backup
  module Compressor
    class Lzma < Base

      ##
      # Tells Backup::Compressor::Lzma to compress
      # better (-9) rather than faster when set to true
      attr_accessor :best

      ##
      # Tells Backup::Compressor::Lzma to compress
      # faster (-1) rather than better when set to true
      attr_accessor :fast

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

        @best ||= false
        @fast ||= false

        instance_eval(&block) if block_given?

        @cmd = "#{ utility(:lzma) }#{ options }"
        @ext = '.lzma'
      end


      ##
      # Yields to the block the compressor command and filename extension.
      def compress_with
        Backup::Logger.warn(
          "[DEPRECATION WARNING]\n" +
          "  Compressor::Lzma is being deprecated as of backup v.3.0.24\n" +
          "  and will soon be removed. Please see the Compressors wiki page at\n" +
          "  https://github.com/meskyanichi/backup/wiki/Compressors"
        )
        super
      end

      private

      def options
        (' --best' if @best) || (' --fast' if @fast)
      end

    end
  end
end

Version data entries

26 entries across 26 versions & 3 rubygems

Version Path
backup-3.11.0 lib/backup/compressor/lzma.rb
backup-3.10.0 lib/backup/compressor/lzma.rb
backup-3.9.0 lib/backup/compressor/lzma.rb
backup-3.8.0 lib/backup/compressor/lzma.rb
backup-3.7.2 lib/backup/compressor/lzma.rb
backup-3.7.1 lib/backup/compressor/lzma.rb
backup-3.7.0 lib/backup/compressor/lzma.rb
backup-3.6.0 lib/backup/compressor/lzma.rb
backup-3.5.1 lib/backup/compressor/lzma.rb
backup-3.5.0 lib/backup/compressor/lzma.rb
backup-3.4.0 lib/backup/compressor/lzma.rb
backup-3.3.2 lib/backup/compressor/lzma.rb
backup-3.3.1 lib/backup/compressor/lzma.rb
backup-3.3.0 lib/backup/compressor/lzma.rb
backup-3.2.0 lib/backup/compressor/lzma.rb
backup-3.1.3 lib/backup/compressor/lzma.rb
backup-3.1.2 lib/backup/compressor/lzma.rb
backup-3.1.1 lib/backup/compressor/lzma.rb
backup-3.1.0 lib/backup/compressor/lzma.rb
backup-agoddard-3.0.28 lib/backup/compressor/lzma.rb