Class: Bard::BackupConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/bard/plugins/backup.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ BackupConfig

Returns a new instance of BackupConfig.



7
8
9
10
# File 'lib/bard/plugins/backup.rb', line 7

def initialize(&block)
  @destinations = []
  instance_eval(&block) if block_given?
end

Instance Attribute Details

#destinationsObject (readonly)

Returns the value of attribute destinations.



5
6
7
# File 'lib/bard/plugins/backup.rb', line 5

def destinations
  @destinations
end

Instance Method Details

#bardObject



12
13
14
# File 'lib/bard/plugins/backup.rb', line 12

def bard
  @bard = true
end

#bard?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/bard/plugins/backup.rb', line 16

def bard?
  !!@bard
end

#disabledObject



20
21
22
# File 'lib/bard/plugins/backup.rb', line 20

def disabled
  @disabled = true
end

#disabled?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/bard/plugins/backup.rb', line 24

def disabled?
  !!@disabled
end

#enabled?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/bard/plugins/backup.rb', line 28

def enabled?
  !disabled?
end

#s3(name, **kwargs) ⇒ Object



32
33
34
35
36
37
38
# File 'lib/bard/plugins/backup.rb', line 32

def s3(name, **kwargs)
  @destinations << {
    name: name,
    type: :s3,
    **kwargs,
  }
end

#self_managed?Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/bard/plugins/backup.rb', line 40

def self_managed?
  @destinations.any?
end