Puppet Function: yum::bool2num_hash_recursive
- Defined in:
- functions/bool2num_hash_recursive.pp
- Function type:
- Puppet Language
Overview
This functions converts the Boolean values of a Hash to Integers, either ‘0’ or ‘1’. It does this recursively, decending as far as the language implemenation will allow. Note that Structs and Arrays will be ignored, even if they contain Hashes.
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'functions/bool2num_hash_recursive.pp', line 29
function yum::bool2num_hash_recursive($arg) {
assert_type(Hash, $arg)
$arg.map |$key, $value| {
$return_value = $value ? {
Boolean => bool2num($value),
Hash => yum::bool2num_hash_recursive($value),
default => $value,
}
# see the issue for the strange/asymetrical whitespace
# https://github.com/kuleuven/puppet-lint-manifest_whitespace-check/issues/8
Hash({ $key => $return_value })
}.reduce |$attrs_memo, $kv| {
$attrs_memo + $kv
}
}
|