aboutsummaryrefslogtreecommitdiff
path: root/lib/URL.pm6
diff options
context:
space:
mode:
Diffstat (limited to 'lib/URL.pm6')
-rw-r--r--lib/URL.pm632
1 files changed, 30 insertions, 2 deletions
diff --git a/lib/URL.pm6 b/lib/URL.pm6
index 57235b4..fa9ebc8 100644
--- a/lib/URL.pm6
+++ b/lib/URL.pm6
@@ -25,7 +25,7 @@ multi method new (
samewith(
|%match,
- path => %match<path>.list
+ path => %match<path>.list,
);
}
@@ -51,6 +51,34 @@ multi method new (
);
}
+#| Append one or more parts to the path of the URL.
+method add-path (
+ *@parts,
+
+ --> URL
+) {
+ return self.new(|self.Hash) unless @parts;
+
+ self.new(
+ |self.Hash,
+ path => [|@!path, |@parts],
+ );
+}
+
+#| Append one or more query parameters to the URL.
+method add-query (
+ *%parts,
+
+ --> URL
+) {
+ return self.new(|self.Hash) unless %parts;
+
+ self.new(
+ |self.Hash,
+ query => %(|%!query, |%parts),
+ );
+}
+
method Hash (
--> Hash
) {
@@ -111,7 +139,7 @@ multi method Str (
=NAME URL
=AUTHOR Patrick Spek <p.spek@tyil.work>
-=VERSION 0.1.0
+=VERSION 0.2.0
=head1 Synopsis