Puppet Function: compact_hash

Defined in:
lib/puppet/parser/functions/compact_hash.rb
Function type:
Ruby 3.x API

Overview

compact_hash() ⇒ Any

Compresses a hash to remove all elements whose values are nil or undef.

Returns:

  • (Any)


22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/puppet/parser/functions/compact_hash.rb', line 22

Puppet::Parser::Functions.newfunction(:compact_hash,
                                      type: :rvalue,
                                      arity: 1,
                                      doc: <<-EOD) do |args|
  @deprecated This function is deprecated. Use the network::compact_hash() function instead.

  Compresses a hash to remove all elements whose values are nil or undef.
                                      EOD

  Puppet.deprecation_warning('compact_hash() is deprecated. Use network::compact_hash() instead.')

  # Call the new network::compact_hash function
  call_function('network::compact_hash', args)
end