Genesis 38:29
27 When it was time for her to give birth, there were twins in her womb. 28 While she was giving birth, one child put out his hand, and the midwife took a scarlet thread and tied it on his hand, saying, “This one came out first.” 29 But then he drew back his hand, and his brother came out before him. She said, “How you have broken out of the womb!” So he was named Perez. 30 Afterward his brother came out—the one who had the scarlet thread on his hand—and he was named Zerah.
Ruth 4:12
10 I have also acquired Ruth the Moabite, the wife of Mahlon, as my wife to raise up a descendant who will inherit his property so the name of the deceased might not disappear from among his relatives and from his village. You are witnesses today.” 11 All the people who were at the gate and the elders replied, “We are witnesses. May the Lord make the woman who is entering your home like Rachel and Leah, both of whom built up the house of Israel! May you prosper in Ephrathah and become famous in Bethlehem. 12 May your family become like the family of Perez—whom Tamar bore to Judah—through the descendants the Lord gives you by this young woman.” 13 So Boaz married Ruth and slept with her. The Lord enabled her to conceive and she gave birth to a son. 14 The village women said to Naomi, “May the Lord be praised because he has not left you without a guardian today! May he become famous in Israel!
Notes and References
"... Ruth’s story concludes with the birth of her son, Obed. This sign of fertility and continuity resolves the problem of famine and death that set Ruth and Naomi’s narrative in motion. The genealogy, then, situates Obed’s climactic birth in the larger biblical narrative, connecting him both to those who came before (back to Perez) and those who would come after (King David). While Ruth does not explicitly appear in the genealogy, the placement of the genealogy at the end of her story creates a close association between Ruth and the genealogy. This is an “intratextual” relationship between the narrative and genealogical portions of the book. The genealogy is Ruth’s genealogy, whether she is named in it or not, because of its placement in her book and its role as an epilogue to her narrative. By including Ruth in his genealogy, the author of Matthew was simply making explicit what was already implicit in the book of Ruth—Ruth’s presence in the genealogy. In addition, there is a close connection between Ruth and Tamar who, as we have already seen, is already a part of the genealogical tradition. Elle van Wolde has traced the many connections between the stories of Ruth and Tamar, including key words, plot, the role of the narrator, and the roles of the characters.63 Van Wolde does not use Genettes’ terminology, but she describes what Genette calls a heterodiegetic transformation.64 That is, basic structures of the story remain the same, while the setting and certain features of the characters change. Also, van Wolde’s identification of several humorous sexual double entendres in Ruth suggest that the tone of Ruth’s hypertextuality in relationship to Genesis 38 is not wholly serious, and contains an element of parody ..."
Rosenberg, Gil "Hypertextuality" in Oropeza, Brisio J., and Steve Moyise, (eds.) Exploring Intertextuality: Diverse Strategies for New Testament Interpretation of Texts (pp. 40-55) Cascade Books, 2016