File tree Expand file tree Collapse file tree
lib/puppet-strings/markdown Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -58,8 +58,9 @@ def initialize(registry, component_type)
5858 { :return_val => 'return' ,
5959 :since => 'since' ,
6060 :summary => 'summary' } . each do |method_name , tag_name |
61+ # @return [String] unless the tag is nil or the string.length == 0
6162 define_method method_name do
62- @tags . select { |tag | tag [ :tag_name ] == "#{ tag_name } " } [ 0 ] [ :text ] unless @tags . select { |tag | tag [ :tag_name ] == "#{ tag_name } " } [ 0 ] . nil?
63+ @tags . select { |tag | tag [ :tag_name ] == "#{ tag_name } " } [ 0 ] [ :text ] unless @tags . select { |tag | tag [ :tag_name ] == "#{ tag_name } " } [ 0 ] . nil? || @tags . select { | tag | tag [ :tag_name ] == " #{ tag_name } " } [ 0 ] [ :text ] . length . zero?
6364 end
6465 end
6566
Original file line number Diff line number Diff line change @@ -8,8 +8,8 @@ Type: <%= type %>
88<%= sig.text %>
99
1010<% end -%>
11- <% if sig.return_val -%>
12- Returns: `<%= sig.return_type %> ` <%= sig.return_val %>
11+ <% if sig.return_type -%>
12+ Returns: `<%= sig.return_type %> `<% if sig.return_val %> <%= sig.return_val %> <% end %>
1313
1414<% end -%>
1515<% if raises -%>
Original file line number Diff line number Diff line change 99* [ ` database ` ] ( #database ) : An example database server type.
1010## Functions
1111* [ ` func ` ] ( #func ) : A simple Puppet function.
12+ * [ ` func3x ` ] ( #func3x ) : Documentation for an example 3.x function.
1213* [ ` func4x ` ] ( #func4x ) : An example 4.x function.
1314* [ ` func4x_1 ` ] ( #func4x_1 ) : An example 4.x function with only one signature.
1415## Classes
@@ -279,6 +280,27 @@ Options:
279280
280281* ** : param3opt ** ` Array ` : Something about this option
281282
283+ ### func3x
284+ Type: Ruby 3.x API
285+
286+ #### ` func3x(String $param1, Integer $param2) `
287+
288+ Documentation for an example 3.x function.
289+
290+ Returns: ` Undef `
291+
292+ ##### ` param1 `
293+
294+ Data type: ` String `
295+
296+ The first parameter.
297+
298+ ##### ` param2 `
299+
300+ Data type: ` Integer `
301+
302+ The second parameter.
303+
282304### func4x
283305Type: Ruby 4.x API
284306
Original file line number Diff line number Diff line change @@ -111,6 +111,19 @@ class klass (
111111 end
112112end
113113
114+ # An example 3.x function
115+ Puppet::Parser::Functions.newfunction(:func3x, doc: <<-DOC
116+ Documentation for an example 3.x function.
117+ @param param1 [String] The first parameter.
118+ @param param2 [Integer] The second parameter.
119+ @return [Undef]
120+ @example Calling the function.
121+ func3x('hi', 10)
122+ DOC
123+ ) do |*args|
124+ #...
125+ end
126+
114127Puppet::Type.type(:database).provide :linux do
115128 desc 'An example provider on Linux.'
116129 confine kernel: 'Linux'
You can’t perform that action at this time.
0 commit comments