Base64 provides utility methods for encoding and de-coding binary data using a base 64 representation. A base 64 representation of binary data consists entirely of printable US-ASCII characters. The Base64 module is included in Ruby 1.8, but has been removed in Ruby 1.9.
Methods
Public Class methods
Decodes a base 64 encoded string to its original representation.
ActiveSupport::Base64.decode64("T3JpZ2luYWwgdW5lbmNvZGVkIHN0cmluZw==")
# => "Original unencoded string"
[ show source ]
# File activesupport/lib/active_support/base64.rb, line 28
28: def self.decode64(data)
29: data.unpack("m").first
30: end
Encodes a string to its base 64 representation. Each 60 characters of output is separated by a newline character.
ActiveSupport::Base64.encode64("Original unencoded string")
# => "T3JpZ2luYWwgdW5lbmNvZGVkIHN0cmluZw==\n"
[ show source ]
# File activesupport/lib/active_support/base64.rb, line 20
20: def self.encode64(data)
21: [data].pack("m")
22: end