lib/librato/config.rb in librato-0.0.4 vs lib/librato/config.rb in librato-0.0.5

- old
+ new

@@ -5,17 +5,18 @@ def [](key) data[key] end def spaces - spaces = options[:spaces] || data['spaces'] || [] - spaces.map { |space| space.is_a?(Hash) ? space : { 'name' => space } } + (options[:spaces] || data['spaces'] || []).map do |space| + space.is_a?(Hash) ? space : { 'name' => space } + end end - def account(name) - env(name).merge(accounts[name] || {}).tap do |account| - validate(account, name) + def accounts + (data['accounts'] || {}).map do |name, account| + env(name).merge(account).tap { |account| validate(account, name) } end end private @@ -29,13 +30,9 @@ File.exist?(path) ? YAML.load_file(path) : {} end def path options[:config] || '.librato.yml' - end - - def accounts - data['accounts'] || {} end def env(name) { 'user' => var(:user, name), 'token' => var(:token, name) } end