Sha256: 5c72a85c3e5e831ee0ff6f5fd772e516fac3552552d11f1300f705115cc804a6
Contents?: true
Size: 486 Bytes
Versions: 4
Compression:
Stored size: 486 Bytes
Contents
# frozen_string_literal: true # This is a backport of ruby 2.5's delete_prefix/delete_suffix methods module DeletePrefixSuffix refine String do def delete_prefix!(str) slice!(0..(str.length - 1)) if start_with?(str) self end def delete_suffix!(str) slice!(-str.length..-1) if end_with?(str) self end def delete_prefix(str) dup.delete_prefix!(str) end def delete_suffix(str) dup.delete_suffix!(str) end end end
Version data entries
4 entries across 4 versions & 1 rubygems