Module: Chef::Validation::ContextExt

Defined in:
lib/chef/validation/ext/context.rb

Class Method Summary collapse

Class Method Details

.cookbook(context, name) ⇒ Chef::CookbookVersion

Returns a single cookbook from the given run context of the given name.

Parameters:

  • context (Chef::RunContext)
  • name (String)

Returns:

  • (Chef::CookbookVersion)


10
11
12
# File 'lib/chef/validation/ext/context.rb', line 10

def cookbook(context, name)
  context.cookbook_collection[name]
end

.cookbooks(context) ⇒ Array<Chef::CookbookVersion>

Returns all loaded cookbooks from the given run context.

Parameters:

  • context (Chef::RunContext)

Returns:

  • (Array<Chef::CookbookVersion>)


19
20
21
# File 'lib/chef/validation/ext/context.rb', line 19

def cookbooks(context)
  context.cookbook_collection.collect { |k, v| v }
end