Flowdock
method

b64encode

Importance_2
Ruby latest stable (v1_9_3_392) - 1 note - Class: Base64

Method deprecated or moved

This method is deprecated or moved on the latest stable version. The last existing version (v1_8_7_330) is shown here.

b64encode(bin, len = 60) public

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==
Show source
Register or log in to add new notes.
October 17, 2008
1 thank

Use encode64!

b64encode will print to the commandline, what a useful featureā€¦