Actions
Feature #6802
openString#scan should have equivalent yielding MatchData
Feature #6802:
String#scan should have equivalent yielding MatchData
Description
Ruby should have method to obtain not an array of arrays but of MatchData objects. It can help in obtaining named groups:
pattern = /x: (?\d+) y:(?\d+)/
polygon = []
text.scan_for_pattern(pattern){|m| polygon << Point.new(m[:x], m[:y]) }
Not to break existing code we need unique name. Ideas? May be #each_match
Actions