encode64

encode64(bin)
Instance Public methods

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

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

Generates:

Tm93IGlzIHRoZSB0aW1lIGZvciBhbGwgZ29vZCBjb2RlcnMKdG8gbGVhcm4g
UnVieQ==
doc_ruby_on_rails
2015-03-30 23:06:02
Comments
Leave a Comment

Please login to continue.