Sha256: d07a707557344cd77b2abc9878dedf4930f714d5e06fb965c0d04b0f97ad8c12

Contents?: true

Size: 774 Bytes

Versions: 2

Compression:

Stored size: 774 Bytes

Contents

# frozen_string_literal: true

module Backup
  module Compressor
    class Base
      include Utilities::Helpers
      include Config::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.info "Using #{compressor_name} for compression.\n" \
          "  Command: '#{@cmd}'\n" \
          "  Ext: '#{@ext}'"
      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/base.rb
backupii-0.1.0.pre.alpha.1 lib/backup/compressor/base.rb