diff options
author | Patrick Spek <p.spek@tyil.nl> | 2020-07-12 10:17:07 +0200 |
---|---|---|
committer | Patrick Spek <p.spek@tyil.nl> | 2023-07-25 02:17:35 +0200 |
commit | de2d56f54918133c4aab7a9f6456c8f8b4511ac1 (patch) | |
tree | d25896b531edcad1fd907ac5053f253e7514fe9e | |
parent | fe8483f11074ea5af95ffe36971e389c685fb2cc (diff) |
Add read method based on a single string
This is mostly to add a little more backwards compatability.
-rw-r--r-- | lib/Config.rakumod | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/Config.rakumod b/lib/Config.rakumod index c987352..9e2a114 100644 --- a/lib/Config.rakumod +++ b/lib/Config.rakumod @@ -177,6 +177,17 @@ multi method read ( self.read(self!read-from-file($path, $parser)); } +#| Update the Config values from a given file. +multi method read ( + Str:D $path, + + Config::Parser:U $parser? is copy, + + --> Config:D +) { + self.read($path.IO, $parser) +} + #| Update the Config values from a list of files. multi method read ( #| A list of paths to configuration files to load. @@ -193,7 +204,7 @@ multi method read ( ) { my %data = %!data; - for @paths -> $path { + for @paths.map(*.IO) -> $path { next if !$path.f && $skip-not-found; X::Config::FileNotFound.new(:$path).throw if !$path.f; |