File: Augment.rakumod

package info (click to toggle)
raku-hash-merge 2.0.0-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 136 kB
  • sloc: makefile: 4
file content (32 lines) | stat: -rw-r--r-- 750 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32

use v6.d;
use MONKEY-TYPING;

use Hash::Merge;

# Don't use precompilation in order to not conflict with other MONKEY-TYPING
# modules.
no precompilation;

augment class Hash {
	method merge (
		Hash:D:

		#| The Hash to merge into this one.
		%hash,

		#| Boolean to set whether Associative objects should be merged on their
		#| own. When set to False, Associative objects in %second will
		#| overwrite those from %first.
		Bool:D :$deep = True,

		#| Boolean to set whether Positional objects should be appended. When
		#| set to False, Positional objects in %second will overwrite those
		#| from %first.
		Bool:D :$positional-append = True,
	) {
		self = merge-hash(self, %hash, :$deep, :$positional-append);
	}
}

# vim: ft=raku ts=4 sw=4 et