Created
April 23, 2012 07:11
-
-
Save gmanley/2469307 to your computer and use it in GitHub Desktop.
Regexp MatchData to_hash monkey patch
This file contains hidden or 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
class MatchData | |
def to_hash | |
Hash[[names, captures].transpose] | |
end | |
alias :to_h :to_hash | |
end |
I used it in conjuction with Facet's Hash#symbolize_keys
Nice, go for it, that'd be great. Thanks!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you are busy, I could add it if you like, giving you full credit and including a unit-test (I already wrote one)