Module: Legion::Crypt::MockVault

Defined in:
lib/legion/crypt/mock_vault.rb

Class Method Summary collapse

Class Method Details

.connected?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/legion/crypt/mock_vault.rb', line 34

def connected?
  true
end

.delete(path) ⇒ Object



19
20
21
22
# File 'lib/legion/crypt/mock_vault.rb', line 19

def delete(path)
  @mutex.synchronize { @store.delete(path) }
  true
end

.list(prefix) ⇒ Object



24
25
26
27
28
# File 'lib/legion/crypt/mock_vault.rb', line 24

def list(prefix)
  @mutex.synchronize do
    @store.keys.select { |k| k.start_with?(prefix) }
  end
end

.read(path) ⇒ Object



10
11
12
# File 'lib/legion/crypt/mock_vault.rb', line 10

def read(path)
  @mutex.synchronize { @store[path]&.dup }
end

.reset!Object



30
31
32
# File 'lib/legion/crypt/mock_vault.rb', line 30

def reset!
  @mutex.synchronize { @store.clear }
end

.write(path, data) ⇒ Object



14
15
16
17
# File 'lib/legion/crypt/mock_vault.rb', line 14

def write(path, data)
  @mutex.synchronize { @store[path] = data.dup }
  true
end