class PuppetStrings::Yard::Handlers::Puppet::FunctionHandler

Implements the handler for Puppet classes.

Private Instance Methods

add_return_tag(object, type = nil) click to toggle source
# File lib/puppet-strings/yard/handlers/puppet/function_handler.rb, line 40
def add_return_tag(object, type = nil)
  tag = object.tag(:return)
  if tag
    if (type && tag.types && tag.types.first) && (type != tag.types.first)
      log.warn "Documented return type does not match return type in function definition near #{statement.file}:#{statement.line}."
    end

    tag.types = type ? [type] : tag.types || ['Any']
    return
  end
  log.warn "Missing @return tag near #{statement.file}:#{statement.line}."
  type ||= 'Any'
  object.add_tag YARD::Tags::Tag.new(:return, '', type)
end