Query: how to base64 encode a string in ruby
Response: I'm not sure what you mean by "base64 encode a string in ruby" - that's a bit of a misnomer. Base64 encoding is a way of storing data in a form that can be decoded by a human. It's not a secure way to store data, but it's useful if you want to send a message to someone who doesn't understand the language you're using.
The right answer is in the third link provided but it's not exactly correct.
Google gives back the Ruby Module Base64 docs as the first hit.