"And the women her neighbours gave it a name, saying, There is a son born to Naomi; and they called his name Obed: he is the father of Jesse, the father of David." (Ruth 4:17)
No one knows for certain who the human author of the fascinating Book of Ruth may have been, but it must at least have been written by a contemporary of David, able to carry the genealogy of Ruth's descendants down to her great-grandson, David. Quite possibly the story was told directly to David himself by his great-grandmother.
In any case, when David later became king, he must surely have been intrigued by the providential circumstances that had led to his anointing. He would have read Genesis 49:8-12 in which Israel had said that a member of the tribe of Judah would be the ruler of the children of Israel some day. He must also have marveled at the wonderful grace of God that brought Ruth, a Moabitess, into his ancestry, despite the proscription in Deuteronomy 23:3 stipulating that Moabites should not be brought into the congregation of the Lord. He undoubtedly noted also that Nahshon, who was the grandfather of Ruth's husband, Boaz, had been the chief captain of the tribe of Judah when Moses led the Israelites out of Egypt (Numbers 1:4-5, 7), but that he had apparently failed in that role and perished in the wilderness, with his fellow tribesman Caleb alone being permitted to enter the Promised Land (Numbers 14:22-24). Yet Nahshon, rather than Caleb, became David's ancestor.
David, like Ruth and like Nahshon, and like everyone of us, has been brought into the great family of the King, not because of our own merits, but by His marvelous grace! We have been born again "not of blood, nor of the will of the flesh, nor of the will of man, but of God" (John 1:13). "Not by works of righteousness which we have done, but according to his mercy he saved us" (Titus 3:5). HMM