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.



181
182
183
184
# File 'lib/bard/config.rb', line 181

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

Instance Attribute Details

#destinationsObject (readonly)

Returns the value of attribute destinations.



179
180
181
# File 'lib/bard/config.rb', line 179

def destinations
  @destinations
end

Instance Method Details

#bardObject



186
187
188
# File 'lib/bard/config.rb', line 186

def bard
  @bard = true
end

#bard?Boolean

Returns:

  • (Boolean)


190
191
192
# File 'lib/bard/config.rb', line 190

def bard?
  !!@bard
end

#disabledObject



194
195
196
# File 'lib/bard/config.rb', line 194

def disabled
  @disabled = true
end

#disabled?Boolean

Returns:

  • (Boolean)


198
199
200
# File 'lib/bard/config.rb', line 198

def disabled?
  !!@disabled
end

#enabled?Boolean

Returns:

  • (Boolean)


202
203
204
# File 'lib/bard/config.rb', line 202

def enabled?
  !disabled?
end

#s3(name, **kwargs) ⇒ Object



206
207
208
209
210
211
212
# File 'lib/bard/config.rb', line 206

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

#self_managed?Boolean

Returns:

  • (Boolean)


214
215
216
# File 'lib/bard/config.rb', line 214

def self_managed?
  @destinations.any?
end