YARD::CodeObjects::ClassObject
A ChefObject is an abstract implementation of all chef elements (cookbooks, resources, providers, recipes, attributes and actions).
Creates a new ChefObject object.
@param namespace [NamespaceObject] namespace to which the object belongs @param name [String] name of the ChefObject
@return [ChefObject] the newly created ChefObject
# File lib/yard-chef/code_objects/chef_object.rb, line 43 def initialize(namespace, name) super(namespace, name) @docstring_type = :markdown end
Factory for creating and registering chef element object in YARD::Registry.
@param namespace [NamespaceObject] namespace to which the object must belong @param name [String] name of the chef element @param type [Symbol, String] type of the chef element
@return [<type>Object] the element object
# File lib/yard-chef/code_objects/chef_object.rb, line 67 def self.register(namespace, name, type) element = @@chef_elements[type] if element element_obj = YARD::Registry.resolve(:root, "#{namespace}::#{name}") if element_obj.nil? element_obj = element.new(namespace, name) log.info "Created [#{type.to_s.capitalize}]" + " #{element_obj.name} => #{element_obj.namespace}" end element_obj else raise "Invalid chef element type #{type}" end end
Returns children of an object of a particular type.
@param type [Symbol] type of ChefObject to be selected
@return [Array<ChefObject>] list of ChefObjects
# File lib/yard-chef/code_objects/chef_object.rb, line 88 def children_by_type(type) children = YARD::Registry.all(type) children.reject { |child| child.parent != self } end
Gets all Chef cookbooks.
@return [Array<CookbookObject>] list of cookbooks.
# File lib/yard-chef/code_objects/chef_object.rb, line 97 def cookbooks children_by_type(:cookbook) end
Generated with the Darkfish Rdoc Generator 2.