Skip to content

Latest commit

 

History

History
82 lines (53 loc) · 2.9 KB

REFERENCE.md

File metadata and controls

82 lines (53 loc) · 2.9 KB

Reference

Table of Contents

Functions

Functions

deeper_merge

Type: Ruby 3.x API

Recursively merges two or more hashes together and returns the resulting hash.

For example:

$hash1 = {'one' => 1, 'two' => 2, 'three' => { 'four' => 4 } }
$hash2 = {'two' => 'dos', 'three' => { 'five' => 5 } }
$merged_hash = deeper_merge($hash1, $hash2)
# The resulting hash is equivalent to:
# $merged_hash = { 'one' => 1, 'two' => 'dos', 'three' => { 'four' => 4, 'five' => 5 } }
$hash1 = { 'key1' => [ 'arrayvalue1', 'arrayvalue2' ] }
$hash2 = { 'key1' => [ 'arrayvalue2', 'arrayvalue3' ] }
$merged_hash = deeper_merge($hash1, $hash2)
# The resulting hash is equivalent to:
# $merged_hash = { key1' => [ 'arrayvalue1', 'arrayvalue2', 'arrayvalue3' ] }

When there is a duplicate key that is a hash, they are recursively merged. When there is a duplicate key that is an array, they are recursively merged with duplicates removed. When there is a duplicate key that is not a hash or an array, the key in the rightmost hash will "win

deeper_merge()

Recursively merges two or more hashes together and returns the resulting hash.

For example:

$hash1 = {'one' => 1, 'two' => 2, 'three' => { 'four' => 4 } }
$hash2 = {'two' => 'dos', 'three' => { 'five' => 5 } }
$merged_hash = deeper_merge($hash1, $hash2)
# The resulting hash is equivalent to:
# $merged_hash = { 'one' => 1, 'two' => 'dos', 'three' => { 'four' => 4, 'five' => 5 } }
$hash1 = { 'key1' => [ 'arrayvalue1', 'arrayvalue2' ] }
$hash2 = { 'key1' => [ 'arrayvalue2', 'arrayvalue3' ] }
$merged_hash = deeper_merge($hash1, $hash2)
# The resulting hash is equivalent to:
# $merged_hash = { key1' => [ 'arrayvalue1', 'arrayvalue2', 'arrayvalue3' ] }

When there is a duplicate key that is a hash, they are recursively merged. When there is a duplicate key that is an array, they are recursively merged with duplicates removed. When there is a duplicate key that is not a hash or an array, the key in the rightmost hash will "win

Returns: Any

hiera_facts::facts_backend

Type: Puppet Language

The hiera_facts::facts_backend function.

hiera_facts::facts_backend(Hash $options, Puppet::LookupContext $context)

The hiera_facts::facts_backend function.

Returns: Hash[RichDataKey, RichData] Returns a hash that contains all collected hiera data for the given configuration.

options

Data type: Hash

Configure fact(s) and path(s) details to be used by the backend.

context

Data type: Puppet::LookupContext

We ignore this argument, it is mandatory for a function to accept it.