summaryrefslogtreecommitdiff
path: root/lib/chef/resource
diff options
context:
space:
mode:
authorTim Smith <tsmith84@gmail.com>2020-10-16 09:50:01 -0700
committerTim Smith <tsmith84@gmail.com>2020-10-16 09:50:01 -0700
commit0b26c901cf3fa8a3e32e4a3f513864bc2d959e04 (patch)
treeb5a3091a06d4df36c9c32b628b74463058ff1849 /lib/chef/resource
parent8c67bf7746301cb73dea14917a7a91f92a37eb13 (diff)
downloadchef-0b26c901cf3fa8a3e32e4a3f513864bc2d959e04.tar.gz
Avoid declaring arrays in loops
There's still a few of these left over, but these are the easy wins with obvious wins. Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'lib/chef/resource')
-rw-r--r--lib/chef/resource/registry_key.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/chef/resource/registry_key.rb b/lib/chef/resource/registry_key.rb
index ae8fcc3688..7e51ea1ef6 100644
--- a/lib/chef/resource/registry_key.rb
+++ b/lib/chef/resource/registry_key.rb
@@ -71,6 +71,8 @@ class Chef
property :key, String, name_property: true
+ VALID_VALUE_HASH_KEYS = %i{name type data}.freeze
+
def values(arg = nil)
if not arg.nil?
if arg.is_a?(Hash)
@@ -88,7 +90,7 @@ class Chef
raise ArgumentError, "Missing name key in RegistryKey values hash" unless v.key?(:name)
v.each_key do |key|
- raise ArgumentError, "Bad key #{key} in RegistryKey values hash" unless %i{name type data}.include?(key)
+ raise ArgumentError, "Bad key #{key} in RegistryKey values hash" unless VALID_VALUE_HASH_KEYS.include?(key)
end
raise ArgumentError, "Type of name => #{v[:name]} should be string" unless v[:name].is_a?(String)