Sha256: e4c2e341f7948ef814ff0dd43770ca7664d07bea83b8ded96c54d515d290b56c
Contents?: true
Size: 681 Bytes
Versions: 3
Compression:
Stored size: 681 Bytes
Contents
module RsyncCron class Options BANDWITH_LIMIT = 5*1024 DEFAULT = { rsh: "ssh", bwlimit: BANDWITH_LIMIT, exclude: "'DfsrPrivate'" } FLAGS = %w[v r t z p L] def initialize(data: DEFAULT, flags: FLAGS) @data = data.to_h @flags = flags.to_a end def to_s [flags, data].compact.join(" ") end def merge(opt) @data = @data.merge(opt) self end private def flags return if @flags.empty? "-#{@flags.join}" end private def data return if @data.empty? @data.reduce([]) do |acc, (opt, val)| acc << "--#{opt}=#{val}" end.join(" ") end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rsync_cron-1.0.7 | lib/rsync_cron/options.rb |
rsync_cron-1.0.6 | lib/rsync_cron/options.rb |
rsync_cron-1.0.5 | lib/rsync_cron/options.rb |