diff options
author | Tim Smith <tsmith84@gmail.com> | 2020-09-16 15:14:34 -0700 |
---|---|---|
committer | Tim Smith <tsmith84@gmail.com> | 2020-09-16 15:32:58 -0700 |
commit | 1ce3174538126c8e3642bf005382f1ee396b5542 (patch) | |
tree | 91cea9acb1701d971c14a92f50b17be569222b76 /lib/chef/mixin | |
parent | 40c71d4e8702894600276f11ce615a9d6334496b (diff) | |
download | chef-1ce3174538126c8e3642bf005382f1ee396b5542.tar.gz |
Resolve Style/RedundantSort warnings
Avoid a sort then last and just grab the max.
Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'lib/chef/mixin')
-rw-r--r-- | lib/chef/mixin/versioned_api.rb | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/chef/mixin/versioned_api.rb b/lib/chef/mixin/versioned_api.rb index eab2ea8228..9333a39101 100644 --- a/lib/chef/mixin/versioned_api.rb +++ b/lib/chef/mixin/versioned_api.rb @@ -50,8 +50,7 @@ class Chef # in which case we'll just start with the highest version and see what happens ServerAPIVersions.instance.min_server_version.nil? || (version >= ServerAPIVersions.instance.min_server_version && version <= ServerAPIVersions.instance.send(type)) end - .sort { |a, b| a.send(:minimum_api_version) <=> b.send(:minimum_api_version) } - .last + .max { |a, b| a.send(:minimum_api_version) <=> b.send(:minimum_api_version) } end def def_versioned_delegator(method) |