Skip to content

Commit 0efcb72

Browse files
committed
Document Str.Version
1 parent a6da455 commit 0efcb72

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

doc/Type/Str.pod6

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,6 +1132,18 @@ they will not be converted to a number by C<val>, by design.
11321132
See L«unival|/routine/unival» if you need to convert such characters to
11331133
C<Numeric>.
11341134
1135+
=head2 method Version
1136+
1137+
method Version(Str:D: --> Version:D)
1138+
1139+
Coerces the string to L<Version|/type/Version>.
1140+
1141+
This could be used for L<type coercion in
1142+
signature|/type/Signature#Coercion_type>, as for example:
1143+
1144+
sub f(Version(Str) $want-version) { say $want-version.^name };
1145+
f "1.2.3"; # OUTPUT: «Version␤»
1146+
11351147
=end pod
11361148

11371149
# vim: expandtab softtabstop=4 shiftwidth=4 ft=perl6

0 commit comments

Comments
 (0)