aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/base64.rb
blob: 602eef06b24352f34ac452d5372b7e17830638d2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
begin
  require 'base64'
rescue LoadError
end

module ActiveSupport
  if defined? ::Base64
    Base64 = ::Base64
  else
    # Ruby 1.9 doesn't provide base64, so we wrap this here
    module Base64

      def self.encode64(data)
        [data].pack("m")
      end

      def self.decode64(data)
        data.unpack("m").first
      end
    end
  end
end