Class: Econfig::Keychain

Inherits:
Object
  • Object
show all
Defined in:
lib/econfig/keychain.rb,
lib/econfig/keychain/version.rb

Constant Summary collapse

VERSION =
"3.0.0"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(keychain, name) ⇒ Keychain

Returns a new instance of Keychain.



8
9
10
# File 'lib/econfig/keychain.rb', line 8

def initialize(keychain, name)
  @store = ::Mellon::Store.new(name, keychain: keychain)
end

Instance Attribute Details

#storeObject (readonly)

Returns the value of attribute store.



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

def store
  @store
end

Instance Method Details

#get(key) ⇒ Object



18
19
20
# File 'lib/econfig/keychain.rb', line 18

def get(key)
  store[key]
end

#has_key?(key) ⇒ Boolean

Returns:

  • (Boolean)


12
13
14
15
16
# File 'lib/econfig/keychain.rb', line 12

def has_key?(key)
  true if store.fetch(key)
rescue KeyError
  false
end

#set(key, value) ⇒ Object



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

def set(key, value)
  store[key] = value
end