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.



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

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

Instance Attribute Details

#destinationsObject (readonly)

Returns the value of attribute destinations.



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

def destinations
  @destinations
end

Instance Method Details

#bardObject



115
116
117
# File 'lib/bard/config.rb', line 115

def bard
  @bard = true
end

#bard?Boolean

Returns:

  • (Boolean)


119
120
121
# File 'lib/bard/config.rb', line 119

def bard?
  !!@bard
end

#disabledObject



123
124
125
# File 'lib/bard/config.rb', line 123

def disabled
  @disabled = true
end

#disabled?Boolean

Returns:

  • (Boolean)


127
128
129
# File 'lib/bard/config.rb', line 127

def disabled?
  !!@disabled
end

#enabled?Boolean

Returns:

  • (Boolean)


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

def enabled?
  !disabled?
end

#s3(name, **kwargs) ⇒ Object



135
136
137
138
139
140
141
# File 'lib/bard/config.rb', line 135

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

#self_managed?Boolean

Returns:

  • (Boolean)


143
144
145
# File 'lib/bard/config.rb', line 143

def self_managed?
  @destinations.any?
end