Sha256: e5cdf7fab8fab30429ea4b300f03987791b370c8ef772067928499e918091220

Contents?: true

Size: 909 Bytes

Versions: 10

Compression:

Stored size: 909 Bytes

Contents

# encoding: utf-8
# 
# 
# 
module Mail
  class ContentTransferEncodingField < StructuredField
    
    FIELD_NAME = 'content-transfer-encoding'
    CAPITALIZED_FIELD = 'Content-Transfer-Encoding'
    
    def initialize(*args)
      super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, args.last.to_s.downcase))
    end
    
    def parse(val = value)
      unless val.blank?
        @element = Mail::ContentTransferEncodingElement.new(val)
        @tree = @element.tree
      end
    end
    
    def tree
      @element ||= Mail::ContentTransferEncodingElement.new(value)
      @tree ||= @element.tree
    end
    
    def element
      @element ||= Mail::ContentTransferEncodingElement.new(value)
    end
    
    def encoding
      element.encoding
    end
    
    # TODO: Fix this up
    def encoded
      "#{CAPITALIZED_FIELD}: #{value}\r\n"
    end
    
    def decoded
      value
    end
    
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
mail-2.1.3 lib/mail/fields/content_transfer_encoding_field.rb
kbaum-mail-2.1.2.1 lib/mail/fields/content_transfer_encoding_field.rb
mail-2.1.2 lib/mail/fields/content_transfer_encoding_field.rb
mail-2.1.1 lib/mail/fields/content_transfer_encoding_field.rb
mail-2.1.0 lib/mail/fields/content_transfer_encoding_field.rb
mail-2.0.5 lib/mail/fields/content_transfer_encoding_field.rb
mail-2.0.3 lib/mail/fields/content_transfer_encoding_field.rb
mail-1.6.0 lib/mail/fields/content_transfer_encoding_field.rb
mail-1.5.4 lib/mail/fields/content_transfer_encoding_field.rb
mail-1.5.3 lib/mail/fields/content_transfer_encoding_field.rb