Created
August 6, 2011 15:42
-
-
Save kboga/1129444 to your computer and use it in GitHub Desktop.
Patch to match for Numification of Match objects
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/core/Match.pm b/src/core/Match.pm | |
index ffb0ae3..eb7a800 100644 | |
--- a/src/core/Match.pm | |
+++ b/src/core/Match.pm | |
@@ -7,6 +7,9 @@ my class Match is Capture { | |
multi method Str(Match:D:) { | |
$!to > $!from ?? $!orig.substr($!from, $!to-$!from) !! ''; | |
} | |
+ method Numeric(Match:D:) { | |
+ self.Str.Numeric; | |
+ } | |
multi method Bool(Match:D:) { | |
$!to >= $!from; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment