From 3f12a8561bd10817db4fc2a4da26d071294a551e Mon Sep 17 00:00:00 2001 From: danielsdeleo Date: Mon, 11 Feb 2013 15:35:29 -0800 Subject: allow lookup of resources without symbol creation --- lib/chef/resource.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'lib/chef/resource.rb') diff --git a/lib/chef/resource.rb b/lib/chef/resource.rb index d18e8b0136..492b6a8f32 100644 --- a/lib/chef/resource.rb +++ b/lib/chef/resource.rb @@ -129,6 +129,18 @@ F extend Chef::Mixin::ConvertToClassName + def self.resource_classes + @resource_classes ||= [] + end + + def self.inherited(subclass) + resource_classes << subclass + end + + def self.find_subclass_by_name(class_name) + resource_classes.first {|c| c.name == class_name } + end + # Set or return the list of "state attributes" implemented by the Resource # subclass. State attributes are attributes that describe the desired state # of the system, such as file permissions or ownership. In general, state -- cgit v1.2.1