Skip to content

Instantly share code, notes, and snippets.

@kboga
Created August 6, 2011 15:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kboga/1129444 to your computer and use it in GitHub Desktop.
Save kboga/1129444 to your computer and use it in GitHub Desktop.
Patch to match for Numification of Match objects
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