From eda41a0ce3ac8cd5ad41791c5d5641c72f7b4bb1 Mon Sep 17 00:00:00 2001 From: Patrick Spek Date: Thu, 18 Mar 2021 23:56:19 +0100 Subject: Call own methods with self --- CHANGELOG.md | 8 ++++++++ lib/Config.rakumod | 6 +++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 93fd1ae..eaae2b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,14 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [UNRELEASED] + +### Changed + +- Methods now use `self` to call `Config` itself, instead of hardcoding to + `Config`. This allows for inheritance with the `Config` class, without + breaking its core functionality. + ## [3.0.3] - 2020-11-16 Due to a user error, version 3.0.2 has been skipped. diff --git a/lib/Config.rakumod b/lib/Config.rakumod index cddf256..e896517 100644 --- a/lib/Config.rakumod +++ b/lib/Config.rakumod @@ -146,7 +146,7 @@ multi method read ( --> Config:D ) { - Config.new( + self.new( %!template, :$!name, data => merge-hash(%!data.clone, %data), @@ -252,7 +252,7 @@ multi method set ( $index = $value; - Config.new( + self.new( %!template, :$!name, :%data, @@ -287,7 +287,7 @@ multi method unset ( $index{@parts[*-1]}:delete; - Config.new( + self.new( %!template, :$!name, :%data, -- cgit v1.1