Sha256: 858c11b4feeadfc7f66be2a90115a77d308fea4ffe2eb33653bca3dc7fd321e2
Contents?: true
Size: 526 Bytes
Versions: 47
Compression:
Stored size: 526 Bytes
Contents
unless String.method_defined? :rpartition require 'backports/tools/arguments' class String def rpartition(pattern) pattern = Backports.coerce_to(pattern, String, :to_str) unless pattern.is_a? Regexp i = rindex(pattern) return ["", "", self] unless i if pattern.is_a? Regexp match = Regexp.last_match [match.pre_match, match[0], match.post_match] else last = i+pattern.length [self[0...i], self[i...last], self[last...length]] end end end end
Version data entries
47 entries across 47 versions & 4 rubygems