summaryrefslogtreecommitdiff
path: root/lib/chef/util/powershell/cmdlet.rb
diff options
context:
space:
mode:
authorTim Smith <tsmith84@gmail.com>2020-11-06 11:26:34 -0800
committerTim Smith <tsmith84@gmail.com>2020-11-06 11:28:03 -0800
commitc6fad3888a03eeab41b63df0c9cbdea5a48f7e97 (patch)
treef08ca91f94580e465b1a468ffbf4ae0419a2a62a /lib/chef/util/powershell/cmdlet.rb
parenta71a65a25b51b52fbb4e2ab4607e584d52cc3b61 (diff)
downloadchef-c6fad3888a03eeab41b63df0c9cbdea5a48f7e97.tar.gz
Collapse several duplicate branches down
Write more compact case statements to prevent duplicate branches. Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'lib/chef/util/powershell/cmdlet.rb')
-rw-r--r--lib/chef/util/powershell/cmdlet.rb12
1 files changed, 3 insertions, 9 deletions
diff --git a/lib/chef/util/powershell/cmdlet.rb b/lib/chef/util/powershell/cmdlet.rb
index ea84798814..1c728fa424 100644
--- a/lib/chef/util/powershell/cmdlet.rb
+++ b/lib/chef/util/powershell/cmdlet.rb
@@ -31,13 +31,9 @@ class Chef
@node = node
case output_format
- when nil
+ when nil, :text
@json_format = false
- when :json
- @json_format = true
- when :text
- @json_format = false
- when :object
+ when :json, :object
@json_format = true
else
raise ArgumentError, "Invalid output format #{output_format} specified"
@@ -128,9 +124,7 @@ class Chef
switch_present = true
case switch_value
- when Numeric
- switch_argument = switch_value.to_s
- when Float
+ when Numeric, Float
switch_argument = switch_value.to_s
when FalseClass
switch_present = false