[ruby/csv] Remove no longer required refinements
(https://github.com/ruby/csv/pull/250) Since PR #159, the minimum Ruby version is 2.5.0, a version which no longer requires refinements for String#delete_suffix?, String#match? and Regexp#match?.
This commit is contained in:
parent
55a900d9cc
commit
a0709d0aae
Notes:
git
2023-05-24 16:44:40 +00:00
@ -1,18 +0,0 @@
|
|||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
# This provides String#delete_suffix? for Ruby 2.4.
|
|
||||||
unless String.method_defined?(:delete_suffix)
|
|
||||||
class CSV
|
|
||||||
module DeleteSuffix
|
|
||||||
refine String do
|
|
||||||
def delete_suffix(suffix)
|
|
||||||
if end_with?(suffix)
|
|
||||||
self[0...-suffix.size]
|
|
||||||
else
|
|
||||||
self
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
@ -1,20 +0,0 @@
|
|||||||
# 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
|
|
Loading…
x
Reference in New Issue
Block a user