Sha256: 0b7dd333a61cf9acb1d6d97ca13737ec135584d78401329444c8e364f627bcd9

Contents?: true

Size: 920 Bytes

Versions: 4

Compression:

Stored size: 920 Bytes

Contents

# encoding: utf-8

module Backup
  module Syncer
    class Base
      include Backup::Utilities::Helpers
      include Backup::Configuration::Helpers

      ##
      # Path to store the synced files/directories to
      attr_accessor :path

      ##
      # Flag for mirroring the files/directories
      attr_accessor :mirror

      def initialize
        load_defaults!

        @path               ||= 'backups'
        @mirror             ||= false
        @directories          = Array.new
      end

      ##
      # Syntactical suger for the DSL for adding directories
      def directories(&block)
        return @directories unless block_given?
        instance_eval(&block)
      end

      ##
      # Adds a path to the @directories array
      def add(path)
        @directories << path
      end

      private

      def syncer_name
        self.class.to_s.sub('Backup::', '')
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
backup-3.1.3 lib/backup/syncer/base.rb
backup-3.1.2 lib/backup/syncer/base.rb
backup-3.1.1 lib/backup/syncer/base.rb
backup-3.1.0 lib/backup/syncer/base.rb