summaryrefslogtreecommitdiff
path: root/lib/chef/resource.rb
diff options
context:
space:
mode:
authorTim Smith <tsmith84@gmail.com>2020-08-03 15:21:16 -0700
committerTim Smith <tsmith84@gmail.com>2020-08-03 16:23:27 -0700
commit9a6ac264ade2ca205b00e4247c7c2d4d8d757f4a (patch)
treeb1d2192c5a04fa6920d92a30c00ca35d883fa98a /lib/chef/resource.rb
parentc202ce4e318a6bc842158970aeb6b3d13fa6a0df (diff)
downloadchef-9a6ac264ade2ca205b00e4247c7c2d4d8d757f4a.tar.gz
Use .key? instead of keys.include
We don't need to create an array that we then search when we can just search the hash. Also disable a few hash like calls that are false positives Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'lib/chef/resource.rb')
-rw-r--r--lib/chef/resource.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/chef/resource.rb b/lib/chef/resource.rb
index f2390b5801..1530243b5d 100644
--- a/lib/chef/resource.rb
+++ b/lib/chef/resource.rb
@@ -673,7 +673,7 @@ class Chef
ivars = instance_variables.map(&:to_sym) - HIDDEN_IVARS
ivars.each do |ivar|
iv = ivar.to_s.sub(/^@/, "")
- if all_props.keys.include?(iv)
+ if all_props.key?(iv)
text << " #{iv} #{all_props[iv]}\n"
elsif (value = instance_variable_get(ivar)) && !(value.respond_to?(:empty?) && value.empty?)
text << " #{iv} #{value_to_text(value)}\n"