Prints the Base64 encoded version of bin (a String) in lines of len (default 60) characters.
require 'base64'
data = "Now is the time for all good coders\nto learn Ruby"
Base64.b64encode(data)
Generates:
Tm93IGlzIHRoZSB0aW1lIGZvciBhbGwgZ29vZCBjb2RlcnMKdG8gbGVhcm4g
UnVieQ==