Sha256: 2fe98b3f982de899b27d72a85a998a076efd00dd665d16805595f7fedcd5cb2b
Contents?: true
Size: 654 Bytes
Versions: 30
Compression:
Stored size: 654 Bytes
Contents
unless String.method_defined? :delete_prefix require 'backports/tools/arguments' class String def delete_prefix(prefix) prefix = Backports.coerce_to_str(prefix) if rindex(prefix, 0) self[prefix.length..-1] else dup end end end end unless String.method_defined? :delete_prefix! require 'backports/tools/arguments' class String def delete_prefix!(prefix) prefix = Backports.coerce_to_str(prefix) chomp! if frozen? len = prefix.length if len > 0 && rindex(prefix, 0) self[0...prefix.length] = '' self else nil end end end end
Version data entries
30 entries across 30 versions & 3 rubygems