mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
21 lines
377 B
Ruby
21 lines
377 B
Ruby
|
# frozen_string_literal: true
|
||
|
|
||
|
# This provides String#match? and Regexp#match? for Ruby 2.3.
|
||
|
unless String.method_defined?(:match?)
|
||
|
class CSV
|
||
|
module MatchP
|
||
|
refine String do
|
||
|
def match?(pattern)
|
||
|
self =~ pattern
|
||
|
end
|
||
|
end
|
||
|
|
||
|
refine Regexp do
|
||
|
def match?(string)
|
||
|
self =~ string
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|