Sha256: dca506b02c2161d209deaaa01eda1daf12adb673194aad819d3aa8c51e4cd9c8

Contents?: true

Size: 1.02 KB

Versions: 68

Compression:

Stored size: 1.02 KB

Contents

# Calls an arbitrary Puppet function by name.
#
# This function takes one mandatory argument and one or more optional arguments:
#
# 1. A string corresponding to a function name.
# 2. Any number of arguments to be passed to the called function.
# 3. An optional lambda, if the function being called supports it.
#
# @example Using the `call` function
#
# ~~~ puppet
# $a = 'notice'
# call($a, 'message')
# ~~~
#
# @example Using the `call` function with a lambda
#
# ~~~ puppet
# $a = 'each'
# $b = [1,2,3]
# call($a, $b) |$item| {
#  notify { $item: }
# }
# ~~~
#
# The `call` function can be used to call either Ruby functions or Puppet language
# functions.
#
# @since 5.0.0
#
Puppet::Functions.create_function(:call, Puppet::Functions::InternalFunction) do
  dispatch :call_impl_block do
    scope_param
    param 'String', :function_name
    repeated_param 'Any', :arguments
    optional_block_param
  end

  def call_impl_block(scope, function_name, *args, &block)
    call_function_with_scope(scope, function_name, *args, &block)
  end
end

Version data entries

68 entries across 68 versions & 2 rubygems

Version Path
puppet-5.3.7 lib/puppet/functions/call.rb
puppet-5.3.7-x86-mingw32 lib/puppet/functions/call.rb
puppet-5.3.7-x64-mingw32 lib/puppet/functions/call.rb
puppet-5.3.7-universal-darwin lib/puppet/functions/call.rb
puppet-5.3.6 lib/puppet/functions/call.rb
puppet-5.3.6-x86-mingw32 lib/puppet/functions/call.rb
puppet-5.3.6-x64-mingw32 lib/puppet/functions/call.rb
puppet-5.3.6-universal-darwin lib/puppet/functions/call.rb
bolt-0.17.1 vendored/puppet/lib/puppet/functions/call.rb
bolt-0.17.0 vendored/puppet/lib/puppet/functions/call.rb
bolt-0.16.4 vendored/puppet/lib/puppet/functions/call.rb
bolt-0.16.3 vendored/puppet/lib/puppet/functions/call.rb
bolt-0.16.2 vendored/puppet/lib/puppet/functions/call.rb
puppet-5.4.0 lib/puppet/functions/call.rb
puppet-5.4.0-x86-mingw32 lib/puppet/functions/call.rb
puppet-5.4.0-x64-mingw32 lib/puppet/functions/call.rb
puppet-5.4.0-universal-darwin lib/puppet/functions/call.rb
puppet-5.3.5 lib/puppet/functions/call.rb
puppet-5.3.5-x86-mingw32 lib/puppet/functions/call.rb
puppet-5.3.5-x64-mingw32 lib/puppet/functions/call.rb