Method: Chef::Resource.action_class
- Defined in:
- lib/chef/resource.rb
.action_class(&block) ⇒ Object
The action class is a Chef::Provider which is created at Resource class evaluation time when the Custom Resource is being constructed.
This happens the first time the ruby parser hits an action or an action_class method, the presence of either indicates that this is going to be a Chef-12.5 custom resource. If we never see one of these directives then we are constructing an old-style Resource+Provider or LWRP or whatever.
If a block is passed, the action_class is always created and the block is run inside it.
1153 1154 1155 1156 1157 |
# File 'lib/chef/resource.rb', line 1153 def self.action_class(&block) @action_class ||= declare_action_class @action_class.class_eval(&block) if block @action_class end |