re-add test for Puppet 3 function

This commit is contained in:
Eric Putnam 2018-02-16 10:49:23 -08:00
parent 49573ca97c
commit 4ea43e03aa
No known key found for this signature in database
GPG Key ID: 3FB595AA224A7751
4 changed files with 39 additions and 3 deletions

View File

@ -58,8 +58,9 @@ module PuppetStrings::Markdown
{ :return_val => 'return',
:since => 'since',
: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
@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

View File

@ -8,8 +8,8 @@ Type: <%= type %>
<%= sig.text %>
<% end -%>
<% if sig.return_val -%>
Returns: `<%= sig.return_type %>` <%= sig.return_val %>
<% if sig.return_type -%>
Returns: `<%= sig.return_type %>`<% if sig.return_val %> <%= sig.return_val %><% end %>
<% end -%>
<% if raises -%>

View File

@ -9,6 +9,7 @@
* [`database`](#database): An example database server type.
## Functions
* [`func`](#func): A simple Puppet function.
* [`func3x`](#func3x): Documentation for an example 3.x function.
* [`func4x`](#func4x): An example 4.x function.
* [`func4x_1`](#func4x_1): An example 4.x function with only one signature.
## Classes
@ -279,6 +280,27 @@ Options:
* **: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
Type: Ruby 4.x API

View File

@ -111,6 +111,19 @@ Puppet::Functions.create_function(:func4x_1) do
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
desc 'An example provider on Linux.'
confine kernel: 'Linux'