diff options
author | Tim Smith <tsmith84@gmail.com> | 2020-11-06 11:26:34 -0800 |
---|---|---|
committer | Tim Smith <tsmith84@gmail.com> | 2020-11-06 11:28:03 -0800 |
commit | c6fad3888a03eeab41b63df0c9cbdea5a48f7e97 (patch) | |
tree | f08ca91f94580e465b1a468ffbf4ae0419a2a62a /lib/chef/util | |
parent | a71a65a25b51b52fbb4e2ab4607e584d52cc3b61 (diff) | |
download | chef-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')
-rw-r--r-- | lib/chef/util/dsc/lcm_output_parser.rb | 4 | ||||
-rw-r--r-- | lib/chef/util/powershell/cmdlet.rb | 12 |
2 files changed, 4 insertions, 12 deletions
diff --git a/lib/chef/util/dsc/lcm_output_parser.rb b/lib/chef/util/dsc/lcm_output_parser.rb index 38c202a4bb..509f680bb4 100644 --- a/lib/chef/util/dsc/lcm_output_parser.rb +++ b/lib/chef/util/dsc/lcm_output_parser.rb @@ -89,9 +89,7 @@ class Chef case op_action when "InDesiredState" current_resource[:skipped] = op_value.strip == "True" ? true : false - when "ResourcesInDesiredState" - current_resource[:name] = op_value.strip if op_value - when "ResourcesNotInDesiredState" + when "ResourcesInDesiredState", "ResourcesNotInDesiredState" current_resource[:name] = op_value.strip if op_value when "ReturnValue" current_resource[:context] = nil 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 |