Class: Backup::Syncer::Base
- Inherits:
-
Object
- Object
- Backup::Syncer::Base
- Includes:
- CLI::Helpers, Configuration::Helpers
- Defined in:
- lib/backup/syncer/base.rb
Direct Known Subclasses
Constant Summary
Constants included from CLI::Helpers
Instance Attribute Summary collapse
-
#mirror ⇒ Object
Flag for mirroring the files/directories.
-
#path ⇒ Object
Path to store the synced files/directories to.
Instance Method Summary collapse
-
#add(path) ⇒ Object
Adds a path to the @directories array.
-
#directories(&block) ⇒ Object
Syntactical suger for the DSL for adding directories.
-
#initialize ⇒ Base
constructor
A new instance of Base.
Methods included from Configuration::Helpers
Constructor Details
#initialize ⇒ Base
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
#mirror ⇒ Object
Flag for mirroring the files/directories
15 16 17 |
# File 'lib/backup/syncer/base.rb', line 15 def mirror @mirror end |
#path ⇒ Object
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 |