module Base64

Ruby 1.9 has dropped the Base64 module, this is a replacement

We could replace all call by Array#pack('m') and String#unpack('m'), but this module improves readability.

Public Class Methods

decode64(data64) click to toggle source

Decode a Base64-encoded String

data64
String

Binary in Base64

result
String

Binary

# File lib/xmpp4r/base64.rb, line 28
def self.decode64(data64)
  data64.unpack('m').first
end
encode64(data) click to toggle source

Encode a String

data
String

Binary

result
String

Binary in Base64

# File lib/xmpp4r/base64.rb, line 20
def self.encode64(data)
  [data].pack('m')
end