class Backup::Syncer::Base
Attributes
excludes[R]
mirror[RW]
Flag for mirroring the files/directories
path[RW]
Path to store the synced files/directories to
syncer_id[R]
Optional user-defined identifier to differentiate multiple syncers defined within a single backup model. Currently this is only used in the log messages.
Public Class Methods
new(syncer_id = nil)
click to toggle source
# File lib/backup/syncer/base.rb, line 24 def initialize(syncer_id = nil) @syncer_id = syncer_id load_defaults! @mirror ||= false @directories ||= [] @excludes ||= [] end
Public Instance Methods
add(path)
click to toggle source
# File lib/backup/syncer/base.rb, line 41 def add(path) directories << path end
directories(&block)
click to toggle source
Syntactical suger for the DSL for adding directories
# File lib/backup/syncer/base.rb, line 36 def directories(&block) return @directories unless block_given? instance_eval(&block) end
Private Instance Methods
log!(action)
click to toggle source
# File lib/backup/syncer/base.rb, line 59 def log!(action) msg = case action when :started then 'Started...' when :finished then 'Finished!' end Logger.info "#{ syncer_name } #{ msg }" end
syncer_name()
click to toggle source
# File lib/backup/syncer/base.rb, line 54 def syncer_name @syncer_name ||= self.class.to_s.sub('Backup::', '') + (syncer_id ? " (#{ syncer_id })" : '') end