aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPatrick Spek <p.spek@tyil.nl>2018-08-26 13:51:54 +0200
committerPatrick Spek <p.spek@tyil.nl>2023-07-25 02:17:11 +0200
commita3fcd57ae5f77054ddbeed87d6a10ff6e8fa0fa8 (patch)
tree395f926f7ede3e15dd404cc2c803ae6d6c10fefd /lib
parent70651300b9eefd0707d342bcf91f1f12e77b234a (diff)
Add .clone method
Diffstat (limited to 'lib')
-rw-r--r--lib/Config.pm610
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/Config.pm6 b/lib/Config.pm6
index 78dca0a..0fecadf 100644
--- a/lib/Config.pm6
+++ b/lib/Config.pm6
@@ -10,8 +10,8 @@ use Hash::Merge;
unit class Config is Associative;
has Hash $!content = {};
-has Str $!path = "";
-has Str $!parser = "";
+has Str $.path = "";
+has Str $.parser = "";
#| Clear the config.
method clear()
@@ -21,6 +21,12 @@ method clear()
$!parser = "";
}
+method clone (
+ --> Config
+) {
+ Config.new(:$!path, :$!parser).read: $!content;
+}
+
#| Return the entire config hash.
multi method get()
{