re-add test for Puppet 3 function
This commit is contained in:
parent
49573ca97c
commit
4ea43e03aa
|
@ -58,8 +58,9 @@ module PuppetStrings::Markdown
|
||||||
{ :return_val => 'return',
|
{ :return_val => 'return',
|
||||||
:since => 'since',
|
:since => 'since',
|
||||||
:summary => 'summary' }.each do |method_name, tag_name|
|
:summary => 'summary' }.each do |method_name, tag_name|
|
||||||
|
# @return [String] unless the tag is nil or the string.length == 0
|
||||||
define_method method_name do
|
define_method method_name do
|
||||||
@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] unless @tags.select { |tag| tag[:tag_name] == "#{tag_name}" }[0].nil? || @tags.select { |tag| tag[:tag_name] == "#{tag_name}" }[0][:text].length.zero?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,8 @@ Type: <%= type %>
|
||||||
<%= sig.text %>
|
<%= sig.text %>
|
||||||
|
|
||||||
<% end -%>
|
<% end -%>
|
||||||
<% if sig.return_val -%>
|
<% if sig.return_type -%>
|
||||||
Returns: `<%= sig.return_type %>` <%= sig.return_val %>
|
Returns: `<%= sig.return_type %>`<% if sig.return_val %> <%= sig.return_val %><% end %>
|
||||||
|
|
||||||
<% end -%>
|
<% end -%>
|
||||||
<% if raises -%>
|
<% if raises -%>
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
* [`database`](#database): An example database server type.
|
* [`database`](#database): An example database server type.
|
||||||
## Functions
|
## Functions
|
||||||
* [`func`](#func): A simple Puppet function.
|
* [`func`](#func): A simple Puppet function.
|
||||||
|
* [`func3x`](#func3x): Documentation for an example 3.x function.
|
||||||
* [`func4x`](#func4x): An example 4.x function.
|
* [`func4x`](#func4x): An example 4.x function.
|
||||||
* [`func4x_1`](#func4x_1): An example 4.x function with only one signature.
|
* [`func4x_1`](#func4x_1): An example 4.x function with only one signature.
|
||||||
## Classes
|
## Classes
|
||||||
|
@ -279,6 +280,27 @@ Options:
|
||||||
|
|
||||||
* **:param3opt** `Array`: Something about this option
|
* **:param3opt** `Array`: Something about this option
|
||||||
|
|
||||||
|
### func3x
|
||||||
|
Type: Ruby 3.x API
|
||||||
|
|
||||||
|
#### `func3x(String $param1, Integer $param2)`
|
||||||
|
|
||||||
|
Documentation for an example 3.x function.
|
||||||
|
|
||||||
|
Returns: `Undef`
|
||||||
|
|
||||||
|
##### `param1`
|
||||||
|
|
||||||
|
Data type: `String`
|
||||||
|
|
||||||
|
The first parameter.
|
||||||
|
|
||||||
|
##### `param2`
|
||||||
|
|
||||||
|
Data type: `Integer`
|
||||||
|
|
||||||
|
The second parameter.
|
||||||
|
|
||||||
### func4x
|
### func4x
|
||||||
Type: Ruby 4.x API
|
Type: Ruby 4.x API
|
||||||
|
|
||||||
|
|
|
@ -111,6 +111,19 @@ Puppet::Functions.create_function(:func4x_1) do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# An example 3.x function
|
||||||
|
Puppet::Parser::Functions.newfunction(:func3x, doc: <<-DOC
|
||||||
|
Documentation for an example 3.x function.
|
||||||
|
@param param1 [String] The first parameter.
|
||||||
|
@param param2 [Integer] The second parameter.
|
||||||
|
@return [Undef]
|
||||||
|
@example Calling the function.
|
||||||
|
func3x('hi', 10)
|
||||||
|
DOC
|
||||||
|
) do |*args|
|
||||||
|
#...
|
||||||
|
end
|
||||||
|
|
||||||
Puppet::Type.type(:database).provide :linux do
|
Puppet::Type.type(:database).provide :linux do
|
||||||
desc 'An example provider on Linux.'
|
desc 'An example provider on Linux.'
|
||||||
confine kernel: 'Linux'
|
confine kernel: 'Linux'
|
||||||
|
|
Loading…
Reference in New Issue