summaryrefslogtreecommitdiff
path: root/lib/chef/chef_class.rb
diff options
context:
space:
mode:
authorRanjib Dey <dey.ranjib@gmail.com>2015-07-16 09:39:02 -0700
committerRanjib Dey <dey.ranjib@gmail.com>2015-07-16 09:39:02 -0700
commit339dbb2d05bee1a0525388941ca2409be8f62ce1 (patch)
tree3cce812a51d371c432bce02b140b96ce5389c1d5 /lib/chef/chef_class.rb
parent9a3e6e04f3bb39c2b2f5749719f0c21dd3f3f2ec (diff)
parentfce939cbafe91eaade275d44c4e1cc5bfa724b2c (diff)
downloadchef-339dbb2d05bee1a0525388941ca2409be8f62ce1.tar.gz
Merge pull request #3242 from ranjib/chef_handler
[RFC-039] chef handler dsl
Diffstat (limited to 'lib/chef/chef_class.rb')
-rw-r--r--lib/chef/chef_class.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/chef/chef_class.rb b/lib/chef/chef_class.rb
index 5cf4f95af5..458ac82467 100644
--- a/lib/chef/chef_class.rb
+++ b/lib/chef/chef_class.rb
@@ -52,7 +52,14 @@ class Chef
#
attr_reader :run_context
+ # Register an event handler with user specified block
#
+ # @return[Chef::EventDispatch::Base] handler object
+ def event_handler(&block)
+ dsl = Chef::EventDispatch::DSL.new('Chef client DSL')
+ 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