It is important to remember that it is possible, and also was much more commonly acknowledged in earlier times, for two men to be like brothers, almost twins, to love each other and have NO sexual feelings for each other at all! Nowadays, men are more shy of expressing such feelings to each other or anyone else!
As for Naomi and Ruth, remember, please, that Ruth had been married to Naomi’s SON, who died, and then went with Naomi back to Israel. Naomi was much older than Ruth, who was probably in her early to mid teens (usual age for a girl to marry back then), Naomi had lost her husband and both adult sons, and was likely in her late 30’s, (for that time, she was basically a Senior Citizen) which was well past middle age in those times. Naomi was Ruth’s Mother-in-law, and was as a Mother to her – NOT a lover!
Not to mention that such a relationship in either case was likely in those times, since it was considered not only a sin, but one which carried the death penalty if found out! And Naomi was concerned for Ruth’s future, since she was a foreigner, not an Israelite, and Naomi being old, was worried about what would happen to Ruth when she died. So, she helped Ruth find a husband among Naomi’s kin.
As for David committing adultery, this could also be a death penalty crime, but being the King, he got away with it. (Until the Prophet pointed out to him that God knew!!) - he paid with the life of the son resulting from that & also had the husband of the woman he committed adultery with left to die at the forefront of a battle. David was definitely in danger of being stoned to death for either one of these sins. As for David being homosexual, HOW MANY WIVES DID HE HAVE??? (A lot!!!) David confessed his sin, and begged forgiveness from God, and because he was truly penitent, he was later blessed by God.