Sha256: 21bfcd0ad607e45be05a5dc4be266f2b0ac66c98fb60d1ad37ab9d90e44033e8
Contents?: true
Size: 677 Bytes
Versions: 1
Compression:
Stored size: 677 Bytes
Contents
# encoding: UTF-8 # frozen_string_literal: true unless Regexp.instance_methods.include?(:match?) && String.instance_methods.include?(:match?) && Symbol.instance_methods.include?(:match?) module RegexpMatchPolyfill module RegexpExtension def match?(string, position = 0) !!(string[position..-1] =~ self) end end module StringExtension def match?(regexp, position = 0) !!(self[position..-1] =~ regexp) end end end Regexp.send :include, RegexpMatchPolyfill::RegexpExtension String.send :include, RegexpMatchPolyfill::StringExtension Symbol.send :include, RegexpMatchPolyfill::StringExtension end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
regexp-match-polyfill-1.0.2 | lib/regexp-match-polyfill.rb |