diff options
author | Tim Smith <tsmith84@gmail.com> | 2020-08-03 14:02:18 -0700 |
---|---|---|
committer | Tim Smith <tsmith84@gmail.com> | 2020-08-03 14:02:18 -0700 |
commit | 413632d2e593d520231801423a4a9d8ea30591e0 (patch) | |
tree | c416e929c840cfc52871103fac0a30627baa5a8f | |
parent | 71088574e7b67850612c43e0804d00baa0984506 (diff) | |
download | chef-rubocop_Performance_RangeInclude.tar.gz |
Resolve Performance/RangeInclude warningsrubocop_Performance_RangeInclude
Use cover? instead of include? with ranges
Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r-- | lib/chef/resource/windows_firewall_rule.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/chef/resource/windows_firewall_rule.rb b/lib/chef/resource/windows_firewall_rule.rb index f1a039267d..7398fb6eb5 100644 --- a/lib/chef/resource/windows_firewall_rule.rb +++ b/lib/chef/resource/windows_firewall_rule.rb @@ -273,11 +273,11 @@ class Chef requirements.assert(:create) do |a| a.assertion do if new_resource.icmp_type.is_a?(Integer) - (0..255).include?(new_resource.icmp_type) + (0..255).cover?(new_resource.icmp_type) elsif new_resource.icmp_type.is_a?(String) && !new_resource.icmp_type.include?(":") && new_resource.protocol.start_with?("ICMP") - (0..255).include?(new_resource.icmp_type.to_i) + (0..255).cover?(new_resource.icmp_type.to_i) elsif new_resource.icmp_type.is_a?(String) && new_resource.icmp_type.include?(":") && new_resource.protocol.start_with?("ICMP") - new_resource.icmp_type.split(":").all? { |type| (0..255).include?(type.to_i) } + new_resource.icmp_type.split(":").all? { |type| (0..255).cover?(type.to_i) } else true end |