File: func4x.rb

package info (click to toggle)
puppet-strings 4.1.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,412 kB
  • sloc: ruby: 7,324; makefile: 12
file content (42 lines) | stat: -rw-r--r-- 1,290 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# An example 4.x function.
#
# @example Calling the function
#   $result = func4x(1, 'foo')
#
# @example Calling the function with all args
#   $result = func4x(1, 'foo', ['bar'])
Puppet::Functions.create_function(:func4x) do
  # An overview for the first overload.
  # @raise SomeError this is some error
  # @param param1 The first parameter.
  # @param param2 The second parameter.
  # @option param2 [String] :option an option
  # @option param2 [String] :option2 another option
  # @param param3 The third parameter.
  # @param param4 The fourth parameter.
  # @enum param4 :one Option one.
  # @enum param4 :two Option two.
  # @return Returns nothing.
  # @example Calling the function foo
  #   $result = func4x(1, 'foooo')
  #
  dispatch :foo do
    param          'Integer',       :param1
    param          'Any',           :param2
    optional_param 'Array[String]', :param3
    optional_param 'Enum[one, two]', :param4
    return_type 'Undef'
  end

  # An overview for the second overload.
  # @param param The first parameter.
  # @param block The block parameter.
  # @return Returns a string.
  # @example Calling the function bar
  #   $result = func4x(1, 'bar', ['foo'])
  dispatch :other do
    param 'Boolean', :param
    block_param
    return_type 'String'
  end
end