diff options
author | Noah Kantrowitz <noah@coderanger.net> | 2016-03-09 09:03:08 -0800 |
---|---|---|
committer | Noah Kantrowitz <noah@coderanger.net> | 2016-03-09 09:03:08 -0800 |
commit | 2e9dee22df33bafbcfcd4ee21a68cba37bcff52e (patch) | |
tree | b6953fb5c51da7458e3c80bfd74e7f83a01d4019 | |
parent | dedb6ddaf84186be97d7436e2ccff7f4e52ee314 (diff) | |
download | chef-2e9dee22df33bafbcfcd4ee21a68cba37bcff52e.tar.gz |
Fix property coercion in both places, because they were different and
one in Chef::Mixin::Properties would result in duplicated values.
-rw-r--r-- | lib/chef/mixin/properties.rb | 2 | ||||
-rw-r--r-- | lib/chef/property.rb | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/lib/chef/mixin/properties.rb b/lib/chef/mixin/properties.rb index 1ee16b8b4a..ae2406f1ae 100644 --- a/lib/chef/mixin/properties.rb +++ b/lib/chef/mixin/properties.rb @@ -95,7 +95,7 @@ class Chef def property(name, type = NOT_PASSED, **options) name = name.to_sym - options.each { |k, v| options[k.to_sym] = v if k.is_a?(String) } + options = options.inject({}) { |memo, (key, value)| memo[key.to_sym] = value; memo } options[:instance_variable_name] = :"@#{name}" if !options.has_key?(:instance_variable_name) options[:name] = name diff --git a/lib/chef/property.rb b/lib/chef/property.rb index 0230c8b23b..95acdeea47 100644 --- a/lib/chef/property.rb +++ b/lib/chef/property.rb @@ -87,7 +87,7 @@ class Chef # is fully initialized. # def initialize(**options) - options.each { |k, v| options[k.to_sym] = v; options.delete(k) if k.is_a?(String) } + options = options.inject({}) { |memo, (key, value)| memo[key.to_sym] = value; memo } @options = options options[:name] = options[:name].to_sym if options[:name] options[:instance_variable_name] = options[:instance_variable_name].to_sym if options[:instance_variable_name] |