Class: RsyncCron::Options

Inherits:
Object
  • Object
show all
Defined in:
lib/rsync_cron/options.rb

Constant Summary collapse

BW_LIMIT =
5*1024
DEFAULT_FLAGS =
%W[verbose archive compress rsh=ssh bwlimit=#{BW_LIMIT} exclude='DfsrPrivate']

Instance Method Summary collapse

Constructor Details

#initialize(flags = DEFAULT_FLAGS) ⇒ Options

Returns a new instance of Options.



6
7
8
# File 'lib/rsync_cron/options.rb', line 6

def initialize(flags = DEFAULT_FLAGS)
  @flags = Array(flags.dup)
end

Instance Method Details

#<<(flags) ⇒ Object



15
16
17
18
19
20
# File 'lib/rsync_cron/options.rb', line 15

def <<(flags)
  flags.split(",").each do |flag|
    @flags << flag if supported?(flag)
  end
  self
end

#to_sObject



10
11
12
13
# File 'lib/rsync_cron/options.rb', line 10

def to_s
  return if @flags.empty?
  @flags.map { |flag| "--#{flag}" }.join(" ")
end