diff options
author | Tim Smith <tsmith84@gmail.com> | 2020-11-04 14:08:59 -0800 |
---|---|---|
committer | Tim Smith <tsmith84@gmail.com> | 2020-11-04 14:08:59 -0800 |
commit | fa6614b06d26f987d585dd97dd4de14af92ce2ea (patch) | |
tree | 22389d093b89889bfdde196e13963d441ee9116d /lib/chef/exceptions.rb | |
parent | 69147fc6d93b120040c735318b6fc1d09a638933 (diff) | |
download | chef-fa6614b06d26f987d585dd97dd4de14af92ce2ea.tar.gz |
Use .compact instead of .select/.reject to remove nilscompact
This is 3-5x faster from the benchmarks I've run locally. There's a cop
coming in the next release of RuboCop to enforce this going forward.
Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'lib/chef/exceptions.rb')
-rw-r--r-- | lib/chef/exceptions.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/chef/exceptions.rb b/lib/chef/exceptions.rb index 16134fe44b..e0b534c3d3 100644 --- a/lib/chef/exceptions.rb +++ b/lib/chef/exceptions.rb @@ -451,7 +451,7 @@ class Chef attr_reader :wrapped_errors def initialize(*errors) - errors = errors.select { |e| !e.nil? } + errors = errors.compact output = "Found #{errors.size} errors, they are stored in the backtrace" @wrapped_errors = errors super output |