Class: Bard::BackupConfig

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ BackupConfig

Returns a new instance of BackupConfig.



111
112
113
114
115
# File 'lib/bard/config.rb', line 111

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

Instance Attribute Details

#bard_enabledObject (readonly)

Returns the value of attribute bard_enabled.



109
110
111
# File 'lib/bard/config.rb', line 109

def bard_enabled
  @bard_enabled
end

#destinationsObject (readonly)

Returns the value of attribute destinations.



109
110
111
# File 'lib/bard/config.rb', line 109

def destinations
  @destinations
end

Instance Method Details

#bardObject



117
118
119
# File 'lib/bard/config.rb', line 117

def bard
  @bard_enabled = true
end

#bard?Boolean

Returns:

  • (Boolean)


130
131
132
# File 'lib/bard/config.rb', line 130

def bard?
  @bard_enabled
end

#s3(name, credentials:, path:) ⇒ Object



121
122
123
124
125
126
127
128
# File 'lib/bard/config.rb', line 121

def s3(name, credentials:, path:)
  @destinations << {
    name: name,
    type: :s3,
    credentials: credentials,
    path: path
  }
end

#self_managed?Boolean

Returns:

  • (Boolean)


134
135
136
# File 'lib/bard/config.rb', line 134

def self_managed?
  @destinations.any?
end