Sha256: e5c0c515182e3c881a1badc582cccff36963933f1a91b89c16c61d35c58ee628

Contents?: true

Size: 557 Bytes

Versions: 1

Compression:

Stored size: 557 Bytes

Contents

module Polyfill
  module V2_4
    module MatchData
      module Instance
        module NamedCaptures
          module Method
            def named_captures
              names.each_with_object({}) do |name, acc|
                acc[name] = self[name]
              end
            end
          end

          if RUBY_VERSION < '2.4.0'
            refine ::MatchData do
              include Method
            end

            def self.included(base)
              base.include Method
            end
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
polyfill-0.3.0 lib/polyfill/v2_4/match_data/instance/named_captures.rb