Sha256: 319cbb597abb2bbc35fdaa13465b23b210d57c041c90da920c7bcdd634fab30a

Contents?: true

Size: 1.03 KB

Versions: 170

Compression:

Stored size: 1.03 KB

Contents

begin
  require 'base64'
rescue LoadError
end

module ActiveSupport
  if defined? ::Base64
    Base64 = ::Base64
  else
    # 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.
    module Base64
      # 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"
      def self.encode64(data)
        [data].pack("m")
      end

      # Decodes a base 64 encoded string to its original representation.
      #
      #  ActiveSupport::Base64.decode64("T3JpZ2luYWwgdW5lbmNvZGVkIHN0cmluZw==") 
      #  # => "Original unencoded string"
      def self.decode64(data)
        data.unpack("m").first
      end
    end
  end
end

Version data entries

170 entries across 137 versions & 22 rubygems

Version Path
radiantcms-couchrest_model-0.1.3 vendor/rails/activesupport/lib/active_support/base64.rb
radiantcms-couchrest_model-0.1.2 vendor/rails/activesupport/lib/active_support/base64.rb
radiantcms-couchrest_model-0.1.1 vendor/rails/activesupport/lib/active_support/base64.rb
radiantcms-couchrest_model-0.1 vendor/rails/activesupport/lib/active_support/base64.rb
abiquo-etk-0.4.33 vendor/activesupport-2.3.8/lib/active_support/base64.rb
abiquo-etk-0.4.32 vendor/activesupport-2.3.8/lib/active_support/base64.rb
abiquo-etk-0.4.29 vendor/activesupport-2.3.8/lib/active_support/base64.rb
abiquo-etk-0.4.25 vendor/activesupport-2.3.8/lib/active_support/base64.rb
abiquo-etk-0.4.24 vendor/activesupport-2.3.8/lib/active_support/base64.rb
abiquo-etk-0.4.23 vendor/activesupport-2.3.8/lib/active_support/base64.rb
abiquo-etk-0.4.22 vendor/activesupport-2.3.8/lib/active_support/base64.rb
abiquo-etk-0.4.20 vendor/activesupport-2.3.8/lib/active_support/base64.rb
abiquo-etk-0.4.19 vendor/activesupport-2.3.8/lib/active_support/base64.rb
abiquo-etk-0.4.18 vendor/activesupport-2.3.8/lib/active_support/base64.rb
abiquo-etk-0.4.17 vendor/activesupport-2.3.8/lib/active_support/base64.rb
abiquo-etk-0.4.16 vendor/activesupport-2.3.8/lib/active_support/base64.rb
abiquo-etk-0.4.15 vendor/activesupport-2.3.8/lib/active_support/base64.rb
abiquo-etk-0.4.14 vendor/activesupport-2.3.8/lib/active_support/base64.rb
abiquo-etk-0.4.13 vendor/activesupport-2.3.8/lib/active_support/base64.rb
activesupport-2.3.10 lib/active_support/base64.rb