summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormokha <mokha@cisco.com>2018-03-19 15:58:15 -0600
committermokha <mokha@cisco.com>2018-03-19 15:58:15 -0600
commit8ea3d5a9fe06531c29a764ff462220dfa53c2bbe (patch)
treef113ea3917dd1fd531590fee17380472e9778003
parent5ad0064be36cb2119bd17c9cae38919b83829ac7 (diff)
use fetch when the profile cannot be found.v0.1.8
-rw-r--r--lib/ats/cli/command.rb2
-rw-r--r--lib/ats/configuration.rb4
2 files changed, 3 insertions, 3 deletions
diff --git a/lib/ats/cli/command.rb b/lib/ats/cli/command.rb
index e6265cf..460d2bc 100644
--- a/lib/ats/cli/command.rb
+++ b/lib/ats/cli/command.rb
@@ -15,7 +15,7 @@ module ATS
def api
self.class.constant_name.new(
- configuration: configuration[profile][self.class.service_name.downcase.to_sym],
+ configuration: configuration.fetch(profile)[self.class.service_name.downcase.to_sym],
debug: configuration.debug,
)
end
diff --git a/lib/ats/configuration.rb b/lib/ats/configuration.rb
index 45eb93b..961563a 100644
--- a/lib/ats/configuration.rb
+++ b/lib/ats/configuration.rb
@@ -13,8 +13,8 @@ module ATS
].compact
end
- def [](key)
- hash[key.to_sym]
+ def fetch(key)
+ hash.fetch(key.to_sym)
end
def to_h