Class: Precursor::Vault

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

Overview

Base class for config vaults

Direct Known Subclasses

ArgvVault, EnvVault, HashVault, YamlVault

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#storeObject (readonly)

Returns the value of attribute store.



6
7
8
# File 'lib/vault.rb', line 6

def store
  @store
end

Instance Method Details

#key?(key) ⇒ Boolean

Returns true if the vault has a value for the given key, otherwise false

Returns:

  • (Boolean)

    true if the vault has a value for the given key, otherwise false



16
17
18
# File 'lib/vault.rb', line 16

def key?(key)
  store.key?(key)
end

#load(config_root) ⇒ Object

Loads vault data from the source

Parameters:



10
11
12
# File 'lib/vault.rb', line 10

def load(config_root)
  @store = load_store(config_root)
end

#value(key) ⇒ Object|Nil

Returns a value fot the given key, nil if key is not available

Returns:

  • (Object|Nil)

    a value for the given key



22
23
24
# File 'lib/vault.rb', line 22

def value(key)
  store[key]
end