1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/lib/csv/delete_suffix.rb

19 lines
381 B
Ruby
Raw Normal View History

# 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 + 1))]
else
self
end
end
end
end
end
end