class YARD::Handlers::Chef::AttributeHandler

Handles attributes in cookbook

Constants

MATCH

Public Instance Methods

attr_hash(nodoc) click to toggle source

Creates the hash to initialize the single attribute object

@return [Hash] the hash to initialize the attribute in the attribute code object

# File lib/yard-chefdoc/handlers/attribute.rb, line 22
def attr_hash(nodoc)
  {
    precedence: statement.jump(:ident).source,
    default: statement.jump(:assign)[1].source,
    docstring: nodoc ? '' : statement.docstring,
    path: statement.source.match(MATCH)[3]
  }
end
process() click to toggle source
# File lib/yard-chefdoc/handlers/attribute.rb, line 11
def process
  attrib_obj = ChefObject.register(filename, :attribute, statement.file)

  docstring_is_header = (statement.docstring == attrib_obj.header)
  attrib_obj.add attr_hash(docstring_is_header) if statement.type == :assign
end