Ruth is so closely connected to David that while she was his great-grandmother on his father's side, it's really as if she were his mother. It's not entirely incorrect to say that Ruth is David's mother.
I like to reread this article every couple of months. It ties in with your post about the women having questionable pasts, explaining what is the purpose of the sketchy origins: