This method could be simpler, just:

string.split.first