Module: Base64

Module | Base64
In: | lib/xmpp4r/base64.rb

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.

### Methods

decode64 encode64

### Public Class methods

decode64(data64)

Decode a Base64-encoded String

data64: | [String] Binary in Base64
result: | [String] Binary

[Source]

        # File lib/xmpp4r/base64.rb, line 28
    28:     def self.decode64(data64)
    29:       data64.unpack('m').first
    30:     end

encode64(data)

Encode a String

data: | [String] Binary
result: | [String] Binary in Base64

[Source]

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

[Validate]