Class: Backup::Syncer::Base

Inherits:
Object
  • Object
show all
Includes:
CLI::Helpers, Configuration::Helpers
Defined in:
lib/backup/syncer/base.rb

Direct Known Subclasses

Cloud::Base, Cloud::S3, RSync::Base

Constant Summary

Constants included from CLI::Helpers

CLI::Helpers::UTILITY

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Configuration::Helpers

included

Constructor Details

#initializeBase

Returns a new instance of Base.



17
18
19
20
21
22
23
# File 'lib/backup/syncer/base.rb', line 17

def initialize
  load_defaults!

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

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Backup::Configuration::Helpers

Instance Attribute Details

#mirrorObject

Flag for mirroring the files/directories



15
16
17
# File 'lib/backup/syncer/base.rb', line 15

def mirror
  @mirror
end

#pathObject

Path to store the synced files/directories to



11
12
13
# File 'lib/backup/syncer/base.rb', line 11

def path
  @path
end

Instance Method Details

#add(path) ⇒ Object

Adds a path to the @directories array



34
35
36
# File 'lib/backup/syncer/base.rb', line 34

def add(path)
  @directories << path
end

#directories(&block) ⇒ Object

Syntactical suger for the DSL for adding directories



27
28
29
30
# File 'lib/backup/syncer/base.rb', line 27

def directories(&block)
  return @directories unless block_given?
  instance_eval(&block)
end