Class: Rustic::Config

Inherits:
Object
  • Object
show all
Includes:
HooksExt
Defined in:
lib/rustic/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from HooksExt

#after, #before

Constructor Details

#initializeConfig

Returns a new instance of Config.



8
9
10
11
# File 'lib/rustic/config.rb', line 8

def initialize
  @restic_path = "restic"
  @strict_validation = false
end

Instance Attribute Details

#backup_configObject (readonly)

Returns the value of attribute backup_config.



6
7
8
# File 'lib/rustic/config.rb', line 6

def backup_config
  @backup_config
end

#check_configObject (readonly)

Returns the value of attribute check_config.



6
7
8
# File 'lib/rustic/config.rb', line 6

def check_config
  @check_config
end

#forget_configObject (readonly)

Returns the value of attribute forget_config.



6
7
8
# File 'lib/rustic/config.rb', line 6

def forget_config
  @forget_config
end

#restic_pathObject (readonly)

Returns the value of attribute restic_path.



6
7
8
# File 'lib/rustic/config.rb', line 6

def restic_path
  @restic_path
end

#strict_validationObject (readonly)

Returns the value of attribute strict_validation.



6
7
8
# File 'lib/rustic/config.rb', line 6

def strict_validation
  @strict_validation
end

Instance Method Details

#backup(&block) ⇒ Object



41
42
43
44
# File 'lib/rustic/config.rb', line 41

def backup(&block)
  @backup_config ||= Rustic::Configs::Backup.new
  @backup_config.instance_eval(&block)
end

#check(&block) ⇒ Object



46
47
48
49
# File 'lib/rustic/config.rb', line 46

def check(&block)
  @check_config ||= Rustic::Configs::Check.new
  @check_config.instance_eval(&block) unless block.nil?
end

#forget(&block) ⇒ Object



51
52
53
54
# File 'lib/rustic/config.rb', line 51

def forget(&block)
  @forget_config ||= Rustic::Configs::Forget.new
  @forget_config.instance_eval(&block)
end

#on_error(&block) ⇒ Object



35
36
37
38
39
# File 'lib/rustic/config.rb', line 35

def on_error(&block)
  return @on_error if block.nil?

  @on_error = block
end

#password(password = nil) ⇒ Object



23
24
25
26
27
# File 'lib/rustic/config.rb', line 23

def password(password = nil)
  return @password if password.nil?

  @password = password
end

#password_file(password_file = nil) ⇒ Object



29
30
31
32
33
# File 'lib/rustic/config.rb', line 29

def password_file(password_file = nil)
  return @password_file if password_file.nil?

  @password_file = password_file
end

#repository(path = nil) ⇒ Object



17
18
19
20
21
# File 'lib/rustic/config.rb', line 17

def repository(path = nil)
  return @path if path.nil?

  @path = path
end

#restic(path) ⇒ Object



13
14
15
# File 'lib/rustic/config.rb', line 13

def restic(path)
  @restic_path = path
end

#strict_validation!Object



56
# File 'lib/rustic/config.rb', line 56

def strict_validation! = @strict_validation = true