This is a Ruby tree! It shows every object from the Ruby Programming Language in a tree format.

rpartition

        # String.rpartition

(from ruby core)
---
    str.rpartition(sep)             -> [head, sep, tail]
    str.rpartition(regexp)          -> [head, match, tail]

---

Searches *sep* or pattern (*regexp*) in the string from the end of the
string, and returns the part before it, the match, and the part after
it. If it is not found, returns two empty strings and *str*.

    "hello".rpartition("l")         #=> ["hel", "l", "o"]
    "hello".rpartition("x")         #=> ["", "", "hello"]
    "hello".rpartition(/.l/)        #=> ["he", "ll", "o"]

The match from the end means starting at the possible last position, not
the last of longest matches.

    "hello".rpartition(/l+/)        #=> ["hel", "l", "o"]

To partition at the last longest match, needs to combine with negative
lookbehind.

    "hello".rpartition(/(?<!l)l+/)  #=> ["he", "ll", "o"]

Or String#partition with negative lookforward.

    "hello".partition(/l+(?!.*l)/)  #=> ["he", "ll", "o"]



      

This is MURDOC! A Ruby documentation browser inspired by Smalltalk-80. It allows you to learn about Ruby by browsing through its class hierarchies, and see any of its methods.