This blog is part of our Ruby 2.4 series.
Ruby has MatchData type which
is returned by
It has methods
#captures to return the names used for capturing
and the actual captured data respectively.
If we want all named captures in a key value pair, we have to
combine the result of names and captures.
Ruby 2.4 adds
#named_captures which returns both the name and data of the