From 579707dec9cba3e80e6ec5a9908c96c3695e4337 Mon Sep 17 00:00:00 2001 From: Patrick Spek Date: Sun, 26 Aug 2018 13:51:54 +0200 Subject: Add .clone method --- lib/Config.pm6 | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'lib') 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() { -- cgit v1.1