~tyil/raku-config

4efcc1c4ed3b39d6a86ccdd20410cde528ffad3c — Patrick Spek 4 months ago e891c1a
Add read method based on a single string

This is mostly to add a little more backwards compatability.
1 files changed, 12 insertions(+), 1 deletions(-)

M lib/Config.rakumod
M lib/Config.rakumod => lib/Config.rakumod +12 -1
@@ 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;