Method: Puppet::Interface::FullDocs#author

Defined in:
lib/puppet/interface/documentation.rb

#author(value) ⇒ Object #authorString?

Overloads:

  • #author(value) ⇒ Object

    Adds an author to the documentation for this object. To set multiple authors, call this once for each author.

    Parameters:

    • value (String)

      the name of the author

  • #authorString?

    This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

    Returns a list of authors

    Returns:

    • (String, nil)

      The names of all authors separated by newlines, or ‘nil` if no authors have been set.



203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
# File 'lib/puppet/interface/documentation.rb', line 203

def author(value = nil)
  unless value.nil? then
    unless value.is_a? String
      # TRANSLATORS 'author' is an attribute name and should not be translated
      raise ArgumentError, _('author must be a string; use multiple statements for multiple authors')
    end

    if value =~ /\n/ then
      # TRANSLATORS 'author' is an attribute name and should not be translated
      raise ArgumentError, _('author should be a single line; use multiple statements for multiple authors')
    end

    @authors.push(Puppet::Interface::DocGen.strip_whitespace(value))
  end
  @authors.empty? ? nil : @authors.join("\n")
end