Sha256: ae18154b092b8483cf61f05b74bc0c6036d2bdb69e695fea20ec0f6d1d4f3ea7

Contents?: true

Size: 811 Bytes

Versions: 23

Compression:

Stored size: 811 Bytes

Contents

# encoding: utf-8
# frozen_string_literal: true
require 'mail/encodings/7bit'

module Mail
  module Encodings
    class Base64 < SevenBit
      NAME = 'base64'
     
      PRIORITY = 3
 
      def self.can_encode?(enc)
        true
      end

      # Decode the string from Base64
      def self.decode(str)
        RubyVer.decode_base64( str )
      end
    
      # Encode the string to Base64
      def self.encode(str)
        ::Mail::Utilities.to_crlf(RubyVer.encode_base64( str ))
      end

      # Base64 has a fixed cost, 4 bytes out per 3 bytes in
      def self.cost(str)
        4.0/3
      end

      # Base64 inserts newlines automatically and cannot violate the SMTP spec.
      def self.compatible_input?(str)
        true
      end

      Encodings.register(NAME, self)      
    end
  end
end

Version data entries

23 entries across 21 versions & 6 rubygems

Version Path
tdiary-5.0.6 vendor/bundle/gems/mail-2.6.6/lib/mail/encodings/base64.rb
tdiary-5.0.5 vendor/bundle/gems/mail-2.6.4/lib/mail/encodings/base64.rb
tdiary-5.0.5 vendor/bundle/gems/mail-2.6.6/lib/mail/encodings/base64.rb
tdiary-5.0.5 vendor/bundle/gems/tdiary-5.0.4/vendor/bundle/gems/mail-2.6.4/lib/mail/encodings/base64.rb
mail-2.6.6 lib/mail/encodings/base64.rb
mail-2.7.0.rc1 lib/mail/encodings/base64.rb
mail-2.6.6.rc1 lib/mail/encodings/base64.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/mail-2.6.5/lib/mail/encodings/base64.rb
mail-2.6.5 lib/mail/encodings/base64.rb
mail-2.6.5.rc1 lib/mail/encodings/base64.rb
tdiary-5.0.4 vendor/bundle/gems/mail-2.6.4/lib/mail/encodings/base64.rb
autocompl-0.2.2 test/dummy/vendor/bundle/ruby/2.3.0/gems/mail-2.6.4/lib/mail/encodings/base64.rb
autocompl-0.2.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/mail-2.6.4/lib/mail/encodings/base64.rb
autocompl-0.2.0 test/dummy/vendor/bundle/ruby/2.3.0/gems/mail-2.6.4/lib/mail/encodings/base64.rb
autocompl-0.1.2 test/dummy/vendor/bundle/ruby/2.3.0/gems/mail-2.6.4/lib/mail/encodings/base64.rb
autocompl-0.1.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/mail-2.6.4/lib/mail/encodings/base64.rb
autocompl-0.1.0 test/dummy/vendor/bundle/ruby/2.3.0/gems/mail-2.6.4/lib/mail/encodings/base64.rb
autocompl-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/mail-2.6.4/lib/mail/encodings/base64.rb
abaci-0.3.0 vendor/bundle/gems/mail-2.6.4/lib/mail/encodings/base64.rb
tdiary-5.0.2 vendor/bundle/gems/mail-2.6.4/lib/mail/encodings/base64.rb