lib/polyfill/v2_4/match_data.rb in polyfill-0.6.0 vs lib/polyfill/v2_4/match_data.rb in polyfill-0.7.0
- old
+ new
@@ -1,9 +1,17 @@
-require_relative 'match_data/instance'
-
module Polyfill
module V2_4
module MatchData
- include Instance
+ def named_captures
+ names.each_with_object({}) do |name, acc|
+ acc[name] = self[name]
+ end
+ end
+
+ def values_at(*indexes)
+ indexes.each_with_object([]) do |index, acc|
+ acc.push(self[index])
+ end
+ end
end
end
end