location.split('\\').last
partition
здесь не правильный инструмент - он разделяется на строку один раз, а не на все найденные места, как задокументировано:
partition(sep) => [head, sep, tail] click to toggle source
Searches the string for sep and returns the part before it, the sep, and the part after it. If sep is not found, returns str and two empty strings. If no argument is given, Enumerable#partition is called.
split
- правильный инструмент для работы, если вы хотите сделать это, разбив содержимое на части.