module Puppet::Interface::FullDocs

This module can be mixed in to provide a full set of documentation attributes. It is intended to be used for {Puppet::Interface}. @api public

Attributes

Public Instance Methods

author(value = nil) click to toggle source

@overload author(value)

Adds an author to the documentation for this object. To set
multiple authors, call this once for each author.
@param value [String] the name of the author
@api public
@dsl Faces

@overload author

Returns a list of authors
@return [String, nil] The names of all authors separated by
  newlines, or `nil` if no authors have been set.
@api private
# File lib/puppet/interface/documentation.rb, line 211
def author(value = nil)
  unless value.nil? then
    unless value.is_a? String
      raise ArgumentError, 'author must be a string; use multiple statements for multiple authors'
    end

    if value =~ /\n/ then
      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
author=(value) click to toggle source

@api private

# File lib/puppet/interface/documentation.rb, line 233
def author=(value)
  # I think it's a bug that this ends up being the exposed
  # version of `author` on ActionBuilder
  if Array(value).any? {|x| x =~ /\n/ } then
    raise ArgumentError, 'author should be a single line; use multiple statements'
  end
  @authors = Array(value).map{|x| Puppet::Interface::DocGen.strip_whitespace(x) }
end
Also aliased as: authors=
authors() click to toggle source

Returns a list of authors. See {author}. @return [String] The list of authors, separated by newlines. @api private

# File lib/puppet/interface/documentation.rb, line 228
def authors
  @authors
end
authors=(value)
Alias for: author=
short_description(value = nil) click to toggle source

@overload #short_description(value)

Sets a short description for this object.
@param value [String, nil] A short description (about a paragraph)
  of this component. If `value` is `nil` the short_description
  will be set to the shorter of the first paragraph or the first
  five lines of {description}.
@return [void]
@api public
@dsl Faces

@overload #short_description

Get the short description for this object
@return [String, nil] The short description of this object. If none is
  set it will be derived from {description}. Returns `nil` if
  {description} is `nil`.
@api private
# File lib/puppet/interface/documentation.rb, line 187
def short_description(value = nil)
  self.short_description = value unless value.nil?
  if @short_description.nil? then
    return nil if @description.nil?
    lines = @description.split("\n")
    first_paragraph_break = lines.index('') || 5
    grab  = [5, first_paragraph_break].min
    @short_description = lines[0, grab].join("\n")
    @short_description += ' [...]' if (grab < lines.length and first_paragraph_break >= 5)
  end
  @short_description
end