lib/rustic/command_builders/forget.rb in rustic-0.3.0 vs lib/rustic/command_builders/forget.rb in rustic-0.3.1
- old
+ new
@@ -1,20 +1,21 @@
# frozen_string_literal: true
class Rustic::CommandBuilders::Forget
+ attr_reader :config
+
def initialize(config)
- @config = config
+ @config = config.forget_config
end
def build
- config = @config.forget_config
- raise Rustic::CommandBuilder::MissingConfigError, "Command `forget` misses it's configuration" if config.nil?
+ raise Rustic::CommandBuilder::MissingConfigError, "Command `forget` misses it's configuration" if @config.nil?
[
"forget",
- config.keep_last ? "--keep-last=#{config.keep_last}" : nil,
- config.keep_weekly ? "--keep-weekly=#{config.keep_weekly}" : nil,
- config.keep_monthly ? "--keep-monthly=#{config.keep_monthly}" : nil,
- config.prune ? "--prune" : nil
+ @config.keep_last ? "--keep-last=#{@config.keep_last}" : nil,
+ @config.keep_weekly ? "--keep-weekly=#{@config.keep_weekly}" : nil,
+ @config.keep_monthly ? "--keep-monthly=#{@config.keep_monthly}" : nil,
+ @config.prune ? "--prune" : nil
].compact
end
end