Class: YARD::Handlers::Chef::DependencyHandler

Inherits:
Base
  • Object
show all
Defined in:
lib/yard-chef/handlers/dependency.rb

Overview

Handles “recipes” in a cookbook.

Instance Method Summary collapse

Methods inherited from Base

#cookbook, #lwrp

Instance Method Details

#nameString

Gets the recipe name from the metadata.rb.

Returns:

  • (String)

    the recipe name



43
44
45
# File 'lib/yard-chef/handlers/dependency.rb', line 43

def name
  statement.parameters.first.jump(:string_content, :ident).source
end

#parse_docsYARD::Docsting

Gets the docstring for the recipe. The docstring is obtained from the description field in the recipe.

Returns:

  • (YARD::Docsting)

    the docstring



52
# File 'lib/yard-chef/handlers/dependency.rb', line 52

def parse_docs; end

#processObject



30
31
32
33
34
35
36
37
# File 'lib/yard-chef/handlers/dependency.rb', line 30

def process
  path_array = statement.file.to_s.split('/')
  return unless path_array.include?('metadata.rb')

  # Recipe declaration in metadata.rb
  dependency_obj = ChefObject.register(cookbook, name, :dependency)
  dependency_obj.docstring = statement.docstring
end