diff options
-rw-r--r-- | lib/Config.pm6 | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/lib/Config.pm6 b/lib/Config.pm6 index ad9be8a..91fafc2 100644 --- a/lib/Config.pm6 +++ b/lib/Config.pm6 @@ -110,6 +110,7 @@ class Config is Associative is export defined($index); } + #| Return a sorted list of all available keys in the current Config. method keys() { my @keys; @@ -121,20 +122,6 @@ class Config is Associative is export @keys.sort; } - submethod extract-keys($key) - { - my $value = self.get($key); - return $key if $value !~~ Iterable; - - my @keys; - - for $value.keys -> $nested-key { - @keys.append: self.extract-keys("{$key}.{$nested-key}"); - } - - return @keys; - } - #| Reload the configuration. Requires the configuration to #| have been loaded from a file. multi method read() @@ -262,4 +249,18 @@ class Config is Associative is export { self.set($key, new); } + + submethod extract-keys($key) + { + my $value = self.get($key); + return $key if $value !~~ Iterable; + + my @keys; + + for $value.keys -> $nested-key { + @keys.append: self.extract-keys("{$key}.{$nested-key}"); + } + + return @keys; + } } |