aboutsummaryrefslogblamecommitdiffstats
path: root/activesupport/lib/active_support/base64.rb
blob: 602eef06b24352f34ac452d5372b7e17830638d2 (plain) (tree)
1
2
3
4
5




                  
















                                                           
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