Class: Mail::ContentTransferEncodingField
- Inherits:
-
NamedStructuredField
- Object
- CommonField
- StructuredField
- NamedStructuredField
- Mail::ContentTransferEncodingField
- Defined in:
- lib/mail/fields/content_transfer_encoding_field.rb
Overview
:nodoc:
Constant Summary collapse
- NAME =
'Content-Transfer-Encoding'
Instance Attribute Summary
Attributes inherited from CommonField
#charset, #errors, #name, #value
Class Method Summary collapse
Instance Method Summary collapse
- #element ⇒ Object
- #encoding ⇒ Object
-
#initialize(value = nil, charset = nil) ⇒ ContentTransferEncodingField
constructor
A new instance of ContentTransferEncodingField.
Methods inherited from CommonField
#decoded, #default, #encoded, #parse, parse, #responsible_for?, #singular?, #to_s
Constructor Details
#initialize(value = nil, charset = nil) ⇒ ContentTransferEncodingField
Returns a new instance of ContentTransferEncodingField.
23 24 25 |
# File 'lib/mail/fields/content_transfer_encoding_field.rb', line 23 def initialize(value = nil, charset = nil) super self.class.normalize_content_transfer_encoding(value), charset end |
Class Method Details
.normalize_content_transfer_encoding(value) ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/mail/fields/content_transfer_encoding_field.rb', line 12 def self.normalize_content_transfer_encoding(value) case value when /7-?bits?/i '7bit' when /8-?bits?/i '8bit' else value end end |
.singular? ⇒ Boolean
8 9 10 |
# File 'lib/mail/fields/content_transfer_encoding_field.rb', line 8 def self.singular? true end |
Instance Method Details
#element ⇒ Object
27 28 29 |
# File 'lib/mail/fields/content_transfer_encoding_field.rb', line 27 def element @element ||= Mail::ContentTransferEncodingElement.new(value) end |
#encoding ⇒ Object
31 32 33 |
# File 'lib/mail/fields/content_transfer_encoding_field.rb', line 31 def encoding element.encoding end |