Class: Mail::ContentTransferEncodingField

Inherits:
StructuredField show all
Defined in:
lib/mail/fields/content_transfer_encoding_field.rb

Constant Summary collapse

FIELD_NAME =
'content-transfer-encoding'
CAPITALIZED_FIELD =
'Content-Transfer-Encoding'

Instance Method Summary collapse

Methods inherited from StructuredField

#default

Methods included from Utilities

included

Methods included from CommonField

included

Constructor Details

#initialize(*args) ⇒ ContentTransferEncodingField

Returns a new instance of ContentTransferEncodingField.



11
12
13
# File 'lib/mail/fields/content_transfer_encoding_field.rb', line 11

def initialize(*args)
  super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, args.last.to_s.downcase))
end

Instance Method Details

#decodedObject



40
41
42
# File 'lib/mail/fields/content_transfer_encoding_field.rb', line 40

def decoded
  value
end

#elementObject



27
28
29
# File 'lib/mail/fields/content_transfer_encoding_field.rb', line 27

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

#encodedObject

TODO: Fix this up



36
37
38
# File 'lib/mail/fields/content_transfer_encoding_field.rb', line 36

def encoded
  "#{CAPITALIZED_FIELD}: #{value}\r\n"
end

#encodingObject



31
32
33
# File 'lib/mail/fields/content_transfer_encoding_field.rb', line 31

def encoding
  element.encoding
end

#parse(val = value) ⇒ Object



15
16
17
18
19
20
# File 'lib/mail/fields/content_transfer_encoding_field.rb', line 15

def parse(val = value)
  unless val.blank?
    @element = Mail::ContentTransferEncodingElement.new(val)
    @tree = @element.tree
  end
end

#treeObject



22
23
24
25
# File 'lib/mail/fields/content_transfer_encoding_field.rb', line 22

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