Class: YARD::CodeObjects::Chef::CookbookObject

Inherits:
ChefObject
  • Object
show all
Defined in:
lib/yard-chef/code_objects/cookbook_object.rb

Overview

A CookbookObject represents a Chef cookbook. See wiki.opscode.com/display/chef/Cookbooks for more information about cookbook.

Instance Attribute Summary collapse

Attributes inherited from ChefObject

#docstring_type

Instance Method Summary collapse

Methods inherited from ChefObject

#children_by_type, #cookbooks, register, register_element

Constructor Details

#initialize(namespace, name) ⇒ CookbookObject

Creates a new CookbookObject instance. belongs

Parameters:

  • namespace (NamespaceObject)

    namespace to which the cookbook

  • name (String)

    name of the cookbook



68
69
70
71
72
73
# File 'lib/yard-chef/code_objects/cookbook_object.rb', line 68

def initialize(namespace, name)
  super(namespace, name)
  @resources = []
  @providers = []
  @libraries = []
end

Instance Attribute Details

#providersArray<ProviderObject> (readonly)

Lightweight providers implemented in the cookbook.

Returns:



59
60
61
# File 'lib/yard-chef/code_objects/cookbook_object.rb', line 59

def providers
  @providers
end

#resourcesArray<ResourceObject> (readonly)

Lightweight resources implemented in the cookbook.

Returns:



53
54
55
# File 'lib/yard-chef/code_objects/cookbook_object.rb', line 53

def resources
  @resources
end

#short_descString

Short description for the cookbook.

Parameters:

  • short_desc (String)

    short description for the cookbook

Returns:

  • (String)

    short description for the cookbook



39
40
41
# File 'lib/yard-chef/code_objects/cookbook_object.rb', line 39

def short_desc
  @short_desc
end

#versionString

Version of the cookbook.

Parameters:

  • version (String)

    version for the cookbook

Returns:

  • (String)

    version for the cookbook



47
48
49
# File 'lib/yard-chef/code_objects/cookbook_object.rb', line 47

def version
  @version
end

Instance Method Details

#attributesArray<AttributeObject>

Attributes implemented in the cookbook.

Returns:



87
88
89
# File 'lib/yard-chef/code_objects/cookbook_object.rb', line 87

def attributes
  children_by_type(:attribute)
end

#definitionsArray<MethodObject>

Definitions implemented in the cookbook.

Returns:

  • (Array<MethodObject>)

    definitions in the cookbook



95
96
97
# File 'lib/yard-chef/code_objects/cookbook_object.rb', line 95

def definitions
  children_by_type(:method)
end

#dependenciesArray<MethodObject>

Dependencies of the cookbook.

Returns:

  • (Array<MethodObject>)

    dependencies of the cookbook



103
104
105
# File 'lib/yard-chef/code_objects/cookbook_object.rb', line 103

def dependencies
  children_by_type(:dependency)
end

#librariesArray<ModuleObject>

Libraries defined in the cookbook.

Returns:

  • (Array<ModuleObject>)

    libraries in the cookbook



111
112
113
114
# File 'lib/yard-chef/code_objects/cookbook_object.rb', line 111

def libraries
  modules = YARD::Registry.all(:module)
  modules.select { |lib| lib.file.split('/').include?(@name.to_s) }
end

#recipesArray<RecipeObject>

Recipes implemented in the cookbook.

Returns:



79
80
81
# File 'lib/yard-chef/code_objects/cookbook_object.rb', line 79

def recipes
  children_by_type(:recipe)
end