Handles “recipes” in a cookbook.
Gets the docstring for the recipe. The docstring is obtained from the description field in the recipe.
@return [YARD::Docsting] the docstring
# File lib/yard-chef/handlers/recipe.rb, line 53 def docstring description = "" # YARD builds an abstract syntax tree (AST) which we need to traverse # to obtain the complete docstring statement.parameters[1].traverse do |child| description << child.jump(:string_content).source if child.type == :string_content end YARD::DocstringParser.new.parse(description).to_docstring end
Gets the recipe name from the metadata.rb.
@return [String] the recipe name
# File lib/yard-chef/handlers/recipe.rb, line 41 def name recipe = statement.parameters.first.jump(:string_content, :ident).source recipe = recipe.split("::")[1] if recipe =~ /::/ recipe = 'default' if recipe == cookbook.name.to_s recipe end
Generated with the Darkfish Rdoc Generator 2.