Ripper#slice

This feature is cool and strange. I can't find a proper documentation, and I debug it by myself trying to understand better the strategy.
It's a kind of regular expression mixed with the lexer. Take a look at the example: