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.5-universal-darwin lib/puppet/functions/call.rb
bolt-0.16.1 vendored/puppet/lib/puppet/functions/call.rb
puppet-5.3.4 lib/puppet/functions/call.rb
puppet-5.3.4-x86-mingw32 lib/puppet/functions/call.rb
puppet-5.3.4-x64-mingw32 lib/puppet/functions/call.rb
puppet-5.3.4-universal-darwin lib/puppet/functions/call.rb
bolt-0.16.0 vendored/puppet/lib/puppet/functions/call.rb
bolt-0.15.0 vendored/puppet/lib/puppet/functions/call.rb
bolt-0.14.0 vendored/puppet/lib/puppet/functions/call.rb
bolt-0.13.0 vendored/puppet/lib/puppet/functions/call.rb
bolt-0.12.0 vendored/puppet/lib/puppet/functions/call.rb
bolt-0.11.0 vendored/puppet/lib/puppet/functions/call.rb
bolt-0.10.0 vendored/puppet/lib/puppet/functions/call.rb
bolt-0.9.0 vendored/puppet/lib/puppet/functions/call.rb
bolt-0.8.0 vendored/puppet/lib/puppet/functions/call.rb
puppet-5.3.3 lib/puppet/functions/call.rb
puppet-5.3.3-x86-mingw32 lib/puppet/functions/call.rb
puppet-5.3.3-x64-mingw32 lib/puppet/functions/call.rb
puppet-5.3.3-universal-darwin lib/puppet/functions/call.rb
bolt-0.7.0 vendored/puppet/lib/puppet/functions/call.rb