When the husband-to-be gave the ring during the engagement ceremony
This is the more common situation. Usually, the boyfriend gives the girlfriend the ring in a private and intimate dinner while he asks her to marry him. If she accepts to marry him, then he will give her the ring. If she does not accept, then he does not give her the ring. In this case, it seems that the ring is a promise of matrimony and the gift is conditional to her promise of matrimony. Here, it would be logic that after the girlfriend changes her mind, she would have to return the ring since it was given to her in exchange for her promise of marriage.
When the husband-to-be gave the ring during an unrelated ceremony
If the ring was given to the girlfriend on her birthday or for Christmas for example, then the situation is not as clear. The girlfriend can later say that, even though the ring typically symbolizes marriage, it was given to her as birthday or Christmas' gift, which makes it not 100% a promise ring. In that case, she would have a good argument to keep it.
Look for the intention of the parties
Answers to legal problems usually depend on the parties' intentions. Unless there is a writing, the person's intention is in the person's mind, something that we cannot see. When the legal problem appears, we have to figure it out the real intentions through peoples actions, which is the only thing we can see.