|
| 1 | +# An example 4.x function. |
| 2 | +# |
| 3 | +# @example Calling the function |
| 4 | +# $result = func4x(1, 'foo') |
| 5 | +# |
| 6 | +# @example Calling the function with all args |
| 7 | +# $result = func4x(1, 'foo', ['bar']) |
| 8 | +Puppet::Functions.create_function(:func4x) do |
| 9 | + # An overview for the first overload. |
| 10 | + # @raise SomeError this is some error |
| 11 | + # @param param1 The first parameter. |
| 12 | + # @param param2 The second parameter. |
| 13 | + # @option param2 [String] :option an option |
| 14 | + # @option param2 [String] :option2 another option |
| 15 | + # @param param3 The third parameter. |
| 16 | + # @param param4 The fourth parameter. |
| 17 | + # @enum param4 :one Option one. |
| 18 | + # @enum param4 :two Option two. |
| 19 | + # @return Returns nothing. |
| 20 | + # @example Calling the function foo |
| 21 | + # $result = func4x(1, 'foooo') |
| 22 | + # |
| 23 | + dispatch :foo do |
| 24 | + param 'Integer', :param1 |
| 25 | + param 'Any', :param2 |
| 26 | + optional_param 'Array[String]', :param3 |
| 27 | + optional_param 'Enum[one, two]', :param4 |
| 28 | + return_type 'Undef' |
| 29 | + end |
| 30 | + |
| 31 | + # An overview for the second overload. |
| 32 | + # @param param The first parameter. |
| 33 | + # @param block The block parameter. |
| 34 | + # @return Returns a string. |
| 35 | + # @example Calling the function bar |
| 36 | + # $result = func4x(1, 'bar', ['foo']) |
| 37 | + dispatch :other do |
| 38 | + param 'Boolean', :param |
| 39 | + block_param |
| 40 | + return_type 'String' |
| 41 | + end |
| 42 | +end |
0 commit comments