class Mail::ContentTransferEncodingField - mail-2.5.4 Documentation

# class Mail::ContentTransferEncodingField

### Constants

CAPITALIZED_FIELD
FIELD_NAME

### Public Class Methods

new(value = nil, charset = 'utf-8') click to toggle source
Calls superclass method

    # File lib/mail/fields/content_transfer_encoding_field.rb, line 10
    def initialize(value = nil, charset = 'utf-8')
      self.charset = charset
      value = '7bit' if value.to_s =~ /7-?bits?/i
      value = '8bit' if value.to_s =~ /8-?bits?/i
      super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, value), charset)
      self.parse
      self
    end

### Public Instance Methods

decoded() click to toggle source

    # File lib/mail/fields/content_transfer_encoding_field.rb, line 44
    def decoded
      encoding
    end

element() click to toggle source

    # File lib/mail/fields/content_transfer_encoding_field.rb, line 31
    def element
      @element ||= Mail::ContentTransferEncodingElement.new(value)
    end

encoded() click to toggle source

TODO: Fix this up

    # File lib/mail/fields/content_transfer_encoding_field.rb, line 40
    def encoded
      "#{CAPITALIZED_FIELD}: #{encoding}\r\n"
    end

encoding() click to toggle source

    # File lib/mail/fields/content_transfer_encoding_field.rb, line 35
    def encoding
      element.encoding
    end

parse(val = value) click to toggle source

    # File lib/mail/fields/content_transfer_encoding_field.rb, line 19
    def parse(val = value)
      unless val.blank?
        @element = Mail::ContentTransferEncodingElement.new(val)
      end
    end

tree() click to toggle source

    # File lib/mail/fields/content_transfer_encoding_field.rb, line 25
    def tree
      STDERR.puts("tree is deprecated.  Please use encoding to get parse result\n#{caller}")
      @element ||= Mail::ContentTransferEncodingElement.new(value)
      @tree ||= @element.tree
    end