Sha256: 3098833cc71214bfdc9cbee3de202e1f62a508be1971283478f06fd3177f8112

Contents?: true

Size: 789 Bytes

Versions: 7

Compression:

Stored size: 789 Bytes

Contents

# encoding: utf-8

module Backup
  module Compressor
    class Base
      include Backup::CLI::Helpers
      include Backup::Configuration::Helpers

      ##
      # Yields to the block the compressor command and filename extension.
      def compress_with
        log!
        yield @cmd, @ext
      end

      private

      ##
      # Return the compressor name, with Backup namespace removed
      def compressor_name
        self.class.to_s.sub('Backup::', '')
      end

      ##
      # Logs a message to the console and log file to inform
      # the client that Backup is using the compressor
      def log!
        Logger.message "Using #{ compressor_name } for compression.\n" +
          "  Command: '#{ @cmd }'\n" +
          "  Ext: '#{ @ext }'"
      end

    end
  end
end

Version data entries

7 entries across 7 versions & 3 rubygems

Version Path
backup-agoddard-3.0.28 lib/backup/compressor/base.rb
backup-agoddard-3.0.27 lib/backup/compressor/base.rb
ey-vendored-backup-3.0.27 lib/backup/compressor/base.rb
backup-3.0.27 lib/backup/compressor/base.rb
backup-3.0.26 lib/backup/compressor/base.rb
backup-3.0.25 lib/backup/compressor/base.rb
backup-3.0.24 lib/backup/compressor/base.rb