summaryrefslogtreecommitdiff
path: root/lib/chef/resource
diff options
context:
space:
mode:
authortyler-ball <tyleraball@gmail.com>2015-09-11 15:29:04 -0500
committerLamont Granquist <lamont@scriptkiddie.org>2015-10-24 20:25:11 -0700
commitdc4236f111c5add48856c995044d2dc66407f6c5 (patch)
treef98102dc64791c78278201a815fa815b3be5e0a6 /lib/chef/resource
parent766a814831c93b14d815ee86a5ba7f21cfd6ff60 (diff)
downloadchef-dc4236f111c5add48856c995044d2dc66407f6c5.tar.gz
We shouldn't be subclassing Struct.new - if the file is loaded twice we get a superclass mismatch error
Diffstat (limited to 'lib/chef/resource')
-rw-r--r--lib/chef/resource/resource_notification.rb15
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/chef/resource/resource_notification.rb b/lib/chef/resource/resource_notification.rb
index a27ed961c7..4fd61ad1f8 100644
--- a/lib/chef/resource/resource_notification.rb
+++ b/lib/chef/resource/resource_notification.rb
@@ -20,7 +20,15 @@ require 'chef/resource'
class Chef
class Resource
- class Notification < Struct.new(:resource, :action, :notifying_resource)
+ class Notification
+
+ attr_accessor :resource, :action, :notifying_resource
+
+ def initialize(resource, action, notifying_resource)
+ @resource = resource
+ @action = action
+ @notifying_resource = notifying_resource
+ end
def duplicates?(other_notification)
unless other_notification.respond_to?(:resource) && other_notification.respond_to?(:action)
@@ -104,6 +112,11 @@ is defined near #{resource.source_line}
raise err
end
+ def ==(other)
+ return false unless other.is_a?(self.class)
+ other.resource == resource && other.action == action && other.notifying_resource == notifying_resource
+ end
+
end
end
end