Class: Bard::Config

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

Instance Method Summary collapse

Instance Method Details

#backup(value = nil, &block) ⇒ Object



47
48
49
50
51
52
53
54
55
56
57
# File 'lib/bard/plugins/backup.rb', line 47

def backup(value = nil, &block)
  if block
    @backup = Bard::BackupConfig.new(&block)
  elsif value == false
    @backup = Bard::BackupConfig.new { disabled }
  elsif value.nil?
    @backup ||= Bard::BackupConfig.new { bard }
  else
    raise ArgumentError, "backup accepts false or a block"
  end
end

#backup_enabled?Boolean

Returns:

  • (Boolean)


59
60
61
# File 'lib/bard/plugins/backup.rb', line 59

def backup_enabled?
  backup == true
end

#encrypt(value = nil) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/bard/plugins/encrypt.rb', line 4

def encrypt(value = nil)
  if value.nil?
    @encrypt
  else
    @encrypt = value
  end
end

#encryption_keyObject



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

def encryption_key
  return nil unless encrypt
  File.read("config/master.key").strip
end