summaryrefslogtreecommitdiff
path: root/lib/chef/node/attribute_collections.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chef/node/attribute_collections.rb')
-rw-r--r--lib/chef/node/attribute_collections.rb20
1 files changed, 8 insertions, 12 deletions
diff --git a/lib/chef/node/attribute_collections.rb b/lib/chef/node/attribute_collections.rb
index 333f4864c6..b912904534 100644
--- a/lib/chef/node/attribute_collections.rb
+++ b/lib/chef/node/attribute_collections.rb
@@ -61,12 +61,10 @@ class Chef
# also invalidate the cached merged_attributes on the root
# Node::Attribute object.
MUTATOR_METHODS.each do |mutator|
- class_eval(<<-METHOD_DEFN, __FILE__, __LINE__)
- def #{mutator}(*args, &block)
- root.reset_cache(root.top_level_breadcrumb)
- super
- end
- METHOD_DEFN
+ define_method(mutator) do |*args, &block|
+ root.reset_cache(root.top_level_breadcrumb)
+ super(*args, &block)
+ end
end
attr_reader :root
@@ -126,12 +124,10 @@ class Chef
# also invalidate the cached `merged_attributes` on the root Attribute
# object.
MUTATOR_METHODS.each do |mutator|
- class_eval(<<-METHOD_DEFN, __FILE__, __LINE__)
- def #{mutator}(*args, &block)
- root.reset_cache(root.top_level_breadcrumb)
- super
- end
- METHOD_DEFN
+ define_method(mutator) do |*args, &block|
+ root.reset_cache(root.top_level_breadcrumb)
+ super(*args, &block)
+ end
end
def initialize(root, data={})