Sha256: fb867916d4020960a5e2aa8f39e3fd2631760ee6e2547ac4079120c2bb68f8fb
Contents?: true
Size: 516 Bytes
Versions: 26
Compression:
Stored size: 516 Bytes
Contents
unless String.method_defined? :rpartition require 'backports/tools' 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
26 entries across 26 versions & 2 rubygems