diff options
author | Patrick Spek <p.spek@tyil.nl> | 2020-07-12 10:17:07 +0200 |
---|---|---|
committer | Patrick Spek <p.spek@tyil.nl> | 2020-07-12 10:17:07 +0200 |
commit | 4efcc1c4ed3b39d6a86ccdd20410cde528ffad3c (patch) | |
tree | d25896b531edcad1fd907ac5053f253e7514fe9e | |
parent | e891c1a542920a94cd7c25a8d9fae473cf9a1b8d (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; |