Flowdock
method

b64encode

Importance_2
v1_8_7_330 - Show latest stable - 1 note - Class: Base64
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…