-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GitHub: #57 In order to support pattern matching in Ruby, add a deconstruct_keys method to RE2::MatchData that will return all named matches if given nil or a subset of matches if given an array of capturing group names as symbols. To match [Ruby's implementation of this](ruby/ruby#6216) there are a few edge cases: 1. If the number of keys given exceeds the number of named capturing groups, immediately return an empty hash. 2. Each key is added to the hash in turn and the first invalid key will cause the hash to be returned so it is possible to get a partial set of named captures.
- Loading branch information
Showing
2 changed files
with
112 additions
and
0 deletions.
There are no files selected for viewing
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
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