24 lines
883 B
Ruby
24 lines
883 B
Ruby
require 'puppet-strings/yard/handlers/puppet/base'
|
|
require 'puppet-strings/yard/parsers'
|
|
require 'puppet-strings/yard/code_objects'
|
|
|
|
# Implements the handler for Puppet classes.
|
|
class PuppetStrings::Yard::Handlers::Puppet::ClassHandler < PuppetStrings::Yard::Handlers::Puppet::Base
|
|
handles PuppetStrings::Yard::Parsers::Puppet::ClassStatement
|
|
|
|
process do
|
|
# Register the object
|
|
object = PuppetStrings::Yard::CodeObjects::Class.new(statement)
|
|
register object
|
|
|
|
# Log a warning if missing documentation
|
|
log.warn "Missing documentation for Puppet class '#{object.name}' at #{statement.file}:#{statement.line}." if object.docstring.empty?
|
|
|
|
# Set the parameter types
|
|
set_parameter_types(object)
|
|
|
|
# Mark the class as public if it doesn't already have an api tag
|
|
object.add_tag YARD::Tags::Tag.new(:api, 'public') unless object.has_tag? :api
|
|
end
|
|
end
|