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 |
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
I used it in conjuction with Facet's Hash#symbolize_keys