Why does the verse go back to Peretz?
Rashi: Because David is attributed to Rus ha'Mo'aviyah, the verse traces his lineage from [Peretz ben] Yehudah.