Module: Puppet::Interface::TinyDocs
Overview
This module can be mixed in to provide a minimal set of documentation attributes.
Instance Method Summary collapse
- #build_synopsis(face, action = nil, arguments = nil) ⇒ Object private
-
#description(description) ⇒ Object
Sets the long description of this object.
-
#summary(summary) ⇒ Object
Sets a summary of this object.
Methods included from DocGen
Instance Method Details
#build_synopsis(face, action = nil, arguments = nil) ⇒ Object
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.
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/puppet/interface/documentation.rb', line 74 def build_synopsis(face, action = nil, arguments = nil) PrettyPrint.format do |s| s.text("puppet #{face}") s.text(" #{action}") unless action.nil? s.text(" ") .each do |option| option = get_option(option) wrap = option.required? ? %w[< >] : %w{[ ]} s.group(0, *wrap) do option.optparse.each do |item| unless s.current_group.first? s.breakable s.text '|' s.breakable end s.text item end end s.breakable end .sort.each do |option| wrap = %w{[ ]} s.group(0, *wrap) do type = Puppet.settings.setting(option).default type ||= Puppet.settings.setting(option).type.to_s.upcase s.text "--#{option} #{type}" s.breakable end s.breakable end if arguments then s.text arguments.to_s end end end |
#description(description) ⇒ Object
Sets the long description of this object.
71 |
# File 'lib/puppet/interface/documentation.rb', line 71 attr_doc :description |
#summary(summary) ⇒ Object
Sets a summary of this object.
59 60 61 62 63 64 |
# File 'lib/puppet/interface/documentation.rb', line 59 attr_doc :summary do |value| value =~ /\n/ and # TRANSLATORS 'Face' refers to a programming API in Puppet, 'summary' and 'description' are specifc attribute names and should not be translated raise ArgumentError, _("Face summary should be a single line; put the long text in 'description' instead.") value end |