encode64(bin) public

Returns the Base64-encoded version of bin. This method complies with RFC 2045. Line feeds are added to every 60 encoded characters.

require 'base64'
Base64.encode64("Now is the time for all good coders\nto learn Ruby")

Generates:

Tm93IGlzIHRoZSB0aW1lIGZvciBhbGwgZ29vZCBjb2RlcnMKdG8gbGVhcm4g
UnVieQ==
Show source
Register or log in to add new notes.
April 24, 2009
0 thanks

test

I need that program :)