Sha256: 98932b81d7e427d8487af5e0b853125d686c1337b19d1b2c73f94c44dd274acb

Contents?: true

Size: 684 Bytes

Versions: 447

Compression:

Stored size: 684 Bytes

Contents

# Returns the keys of a hash as an Array
#
# @example Using `keys`
#
# ```puppet
# $hsh = {"apples" => 3, "oranges" => 4 }
# $hsh.keys()
# keys($hsh)
# # both results in the array ["apples", "oranges"]
# ```
#
# * Note that a hash in the puppet language accepts any data value (including `undef`) unless
#   it is constrained with a `Hash` data type that narrows the allowed data types.
# * For an empty hash, an empty array is returned.
# * The order of the keys is the same as the order in the hash (typically the order in which they were added).
#
Puppet::Functions.create_function(:keys) do
  dispatch :keys do
    param 'Hash', :hsh
  end

  def keys(hsh)
    hsh.keys
  end
end

Version data entries

447 entries across 447 versions & 2 rubygems

Version Path
puppet-7.34.0 lib/puppet/functions/keys.rb
puppet-7.34.0-x86-mingw32 lib/puppet/functions/keys.rb
puppet-7.34.0-x64-mingw32 lib/puppet/functions/keys.rb
puppet-7.34.0-universal-darwin lib/puppet/functions/keys.rb
puppet-7.33.0 lib/puppet/functions/keys.rb
puppet-7.33.0-x86-mingw32 lib/puppet/functions/keys.rb
puppet-7.33.0-x64-mingw32 lib/puppet/functions/keys.rb
puppet-7.33.0-universal-darwin lib/puppet/functions/keys.rb
puppet-7.32.1 lib/puppet/functions/keys.rb
puppet-7.32.1-x86-mingw32 lib/puppet/functions/keys.rb
puppet-7.32.1-x64-mingw32 lib/puppet/functions/keys.rb
puppet-7.32.1-universal-darwin lib/puppet/functions/keys.rb
puppet-7.31.0 lib/puppet/functions/keys.rb
puppet-7.31.0-x86-mingw32 lib/puppet/functions/keys.rb
puppet-7.31.0-x64-mingw32 lib/puppet/functions/keys.rb
puppet-7.31.0-universal-darwin lib/puppet/functions/keys.rb
puppet-7.30.0 lib/puppet/functions/keys.rb
puppet-7.30.0-x86-mingw32 lib/puppet/functions/keys.rb
puppet-7.30.0-x64-mingw32 lib/puppet/functions/keys.rb
puppet-7.30.0-universal-darwin lib/puppet/functions/keys.rb