summaryrefslogtreecommitdiff
path: root/lib/chef/chef_class.rb
diff options
context:
space:
mode:
authorRanjib Dey <ranjib@pagerduty.com>2015-04-18 18:06:06 -0700
committerRanjib Dey <ranjib@pagerduty.com>2015-04-18 18:06:06 -0700
commitfdde9a0a476c407d34882631b50406cf585c6602 (patch)
tree31feb3b66cb915adb61757852d6190b38a2b14bf /lib/chef/chef_class.rb
parent466421102c41b4f99e0f503aca631d762bb8455c (diff)
downloadchef-fdde9a0a476c407d34882631b50406cf585c6602.tar.gz
[RFC-039] chef handler dsl
Diffstat (limited to 'lib/chef/chef_class.rb')
-rw-r--r--lib/chef/chef_class.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/chef/chef_class.rb b/lib/chef/chef_class.rb
index d3f7ee55c7..60dd5efef4 100644
--- a/lib/chef/chef_class.rb
+++ b/lib/chef/chef_class.rb
@@ -43,6 +43,12 @@ class Chef
# @return [Chef::RunContext] run_context of the chef-client run
attr_reader :run_context
+ # Adds an event handler with user defined block
+ def event_handler(&block)
+ dsl = Chef::EventDispatch::DSL.new
+ dsl.instance_eval(&block)
+ end
+
# Get the array of providers associated with a resource_name for the current node
#
# @param resource_name [Symbol] name of the resource as a symbol