Module: Polyfill::V2_4::MatchData

Defined in:
lib/polyfill/v2_4/match_data.rb

Instance Method Summary collapse

Instance Method Details

#named_capturesObject



4
5
6
7
8
# File 'lib/polyfill/v2_4/match_data.rb', line 4

def named_captures
  names.each_with_object({}) do |name, acc|
    acc[name] = self[name]
  end
end

#values_at(*indexes) ⇒ Object



10
11
12
13
14
# File 'lib/polyfill/v2_4/match_data.rb', line 10

def values_at(*indexes)
  indexes.each_with_object([]) do |index, acc|
    acc.push(self[index])
  end
end