diff options
Diffstat (limited to 'lib/chef/node/attribute.rb')
-rw-r--r-- | lib/chef/node/attribute.rb | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/lib/chef/node/attribute.rb b/lib/chef/node/attribute.rb index 3c48f653eb..45f2ef01ee 100644 --- a/lib/chef/node/attribute.rb +++ b/lib/chef/node/attribute.rb @@ -138,11 +138,9 @@ class Chef :values, :values_at, :zip].each do |delegated_method| - class_eval(<<-METHOD_DEFN) - def #{delegated_method}(*args, &block) - merged_attributes.send(:#{delegated_method}, *args, &block) - end - METHOD_DEFN + define_method(delegated_method) do |*args, &block| + merged_attributes.send(delegated_method, *args, &block) + end end # return the cookbook level default attribute component @@ -253,7 +251,7 @@ class Chef if path.nil? @deep_merge_cache = {} else - deep_merge_cache.delete(path) + deep_merge_cache.delete(path.to_s) end end @@ -436,12 +434,12 @@ class Chef end def [](key) - if deep_merge_cache.has_key?(key) + if deep_merge_cache.has_key?(key.to_s) # return the cache of the deep merged values by top-level key - deep_merge_cache[key] + deep_merge_cache[key.to_s] else # save all the work of computing node[key] - deep_merge_cache[key] = merged_attributes(key) + deep_merge_cache[key.to_s] = merged_attributes(key) end end @@ -477,6 +475,10 @@ class Chef end end + def to_s + merged_attributes.to_s + end + def inspect "#<#{self.class} " << (COMPONENTS + [:@merged_attributes, :@properties]).map{|iv| "#{iv}=#{instance_variable_get(iv).inspect}" |