Sha256: 21deffbb7938588607c840afc607d88a6217de636c575007a006a71d939ba3f5

Contents?: true

Size: 858 Bytes

Versions: 16

Compression:

Stored size: 858 Bytes

Contents

# encoding: utf-8
# frozen_string_literal: true
require 'mail/fields/named_structured_field'

module Mail
  class ContentTransferEncodingField < NamedStructuredField #:nodoc:
    NAME = 'Content-Transfer-Encoding'

    def self.singular?
      true
    end

    def self.normalize_content_transfer_encoding(value)
      case value
      when /7-?bits?/i
        '7bit'
      when /8-?bits?/i
        '8bit'
      else
        value
      end
    end

    def initialize(value = nil, charset = nil)
      super self.class.normalize_content_transfer_encoding(value), charset
    end

    def element
      @element ||= Mail::ContentTransferEncodingElement.new(value)
    end

    def encoding
      element.encoding
    end

    private
      def do_encode
        "#{name}: #{encoding}\r\n"
      end

      def do_decode
        encoding
      end
  end
end

Version data entries

16 entries across 15 versions & 6 rubygems

Version Path
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.1.0/gems/mail-2.8.1/lib/mail/fields/content_transfer_encoding_field.rb
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.3.0/gems/mail-2.8.1/lib/mail/fields/content_transfer_encoding_field.rb
minato_ruby_api_client-0.2.2 vendor/bundle/ruby/3.2.0/gems/mail-2.8.1/lib/mail/fields/content_transfer_encoding_field.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/mail-2.8.1/lib/mail/fields/content_transfer_encoding_field.rb
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/mail-2.8.1/lib/mail/fields/content_transfer_encoding_field.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/mail-2.8.1/lib/mail/fields/content_transfer_encoding_field.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/mail-2.8.1/lib/mail/fields/content_transfer_encoding_field.rb
tinymce-rails-7.1.2 vendor/bundle/ruby/3.3.0/gems/mail-2.8.1/lib/mail/fields/content_transfer_encoding_field.rb
mail-2.8.1 lib/mail/fields/content_transfer_encoding_field.rb
mail-2.8.1.rc2 lib/mail/fields/content_transfer_encoding_field.rb
mail-2.8.0.1 lib/mail/fields/content_transfer_encoding_field.rb
mail-2.8.0.1.rc1 lib/mail/fields/content_transfer_encoding_field.rb
mail-2.8.0 lib/mail/fields/content_transfer_encoding_field.rb
mail-2.8.0.rc3 lib/mail/fields/content_transfer_encoding_field.rb
mail-2.8.0.rc2 lib/mail/fields/content_transfer_encoding_field.rb
mail-2.8.0.rc1 lib/mail/fields/content_transfer_encoding_field.rb