Sha256: 56b7c975b74e81dc0f8da658b1341d3eb5aeba2000938e68794739f596c33b43

Contents?: true

Size: 549 Bytes

Versions: 24

Compression:

Stored size: 549 Bytes

Contents

# Call a lambda with the given arguments. Since the parameters of the lambda
# are local to the lambda's scope, this can be used to create private sections
# of logic in a class so that the variables are not visible outside of the
# class.
#
# @example Using with
#
#     # notices the array [1, 2, 'foo']
#     with(1, 2, 'foo') |$x, $y, $z| { notice [$x, $y, $z] }
#
# @since 3.7.0
#
Puppet::Functions.create_function(:with) do
  dispatch :with do
    repeated_param 'Any', :arg
    block_param
  end

  def with(*args)
    yield(*args)
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
puppet-3.8.7 lib/puppet/functions/with.rb
puppet-3.8.7-x86-mingw32 lib/puppet/functions/with.rb
puppet-3.8.7-x64-mingw32 lib/puppet/functions/with.rb
puppet-3.8.6 lib/puppet/functions/with.rb
puppet-3.8.6-x86-mingw32 lib/puppet/functions/with.rb
puppet-3.8.6-x64-mingw32 lib/puppet/functions/with.rb
puppet-3.8.5 lib/puppet/functions/with.rb
puppet-3.8.5-x86-mingw32 lib/puppet/functions/with.rb
puppet-3.8.5-x64-mingw32 lib/puppet/functions/with.rb
puppet-3.8.4 lib/puppet/functions/with.rb
puppet-3.8.4-x86-mingw32 lib/puppet/functions/with.rb
puppet-3.8.4-x64-mingw32 lib/puppet/functions/with.rb
puppet-3.8.3 lib/puppet/functions/with.rb
puppet-3.8.3-x86-mingw32 lib/puppet/functions/with.rb
puppet-3.8.3-x64-mingw32 lib/puppet/functions/with.rb
puppet-3.8.2 lib/puppet/functions/with.rb
puppet-3.8.2-x86-mingw32 lib/puppet/functions/with.rb
puppet-3.8.2-x64-mingw32 lib/puppet/functions/with.rb
puppet-3.8.1 lib/puppet/functions/with.rb
puppet-3.8.1-x86-mingw32 lib/puppet/functions/with.rb