Class: Multichain::Wallets

Inherits:
Hash
  • Object
show all
Defined in:
lib/multichain/wallets.rb

Instance Method Summary collapse

Constructor Details

#initializeWallets

Returns a new instance of Wallets.



3
4
5
6
7
# File 'lib/multichain/wallets.rb', line 3

def initialize
  yaml_path = "#{ENV['HOME']}/.multichain/wallets.yml"
  yaml_path = 'spec/support/fixtures/wallets.yml' if ENV['TEST']
  self.update YAML.load_file yaml_path
end

Instance Method Details

#fetch(key) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/multichain/wallets.rb', line 9

def fetch key
  keys = key.split ':'
  if keys[1]
    return self[keys[0]][keys[1]]
  end
  self[key][self[key].keys[0]]
end