Class: Mail::ReferencesField
- Inherits:
-
CommonMessageIdField
- Object
- CommonField
- StructuredField
- NamedStructuredField
- CommonMessageIdField
- Mail::ReferencesField
- Defined in:
- lib/mail/fields/references_field.rb
Overview
References Field
The References field inherits references StructuredField and handles the References: header field in the email.
Sending references to a mail message will instantiate a Mail::Field object that has a ReferencesField as its field type. This includes all Mail::CommonAddress module instance metods.
Note that, the #message_ids method will return an array of message IDs without the enclosing angle brackets which per RFC are not syntactically part of the message id.
Only one References field can appear in a header, though it can have multiple Message IDs.
Examples:
mail = Mail.new
mail.references = '<[email protected]>'
mail.references #=> '<[email protected]>'
mail[:references] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::ReferencesField:0x180e1c4
mail['references'] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::ReferencesField:0x180e1c4
mail['References'] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::ReferencesField:0x180e1c4
mail[:references]. #=> ['[email protected]']
Constant Summary collapse
- NAME =
:nodoc:
'References'
Instance Attribute Summary
Attributes inherited from CommonField
#charset, #errors, #name, #value
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(value = nil, charset = nil) ⇒ ReferencesField
constructor
A new instance of ReferencesField.
Methods inherited from CommonMessageIdField
#default, #element, #message_id, #message_ids, #to_s
Methods inherited from CommonField
#decoded, #default, #element, #encoded, #parse, parse, #responsible_for?, #singular?, #to_s
Constructor Details
#initialize(value = nil, charset = nil) ⇒ ReferencesField
Returns a new instance of ReferencesField.
37 38 39 40 |
# File 'lib/mail/fields/references_field.rb', line 37 def initialize(value = nil, charset = nil) value = value.join("\r\n\s") if value.is_a?(Array) super value, charset end |
Class Method Details
.singular? ⇒ Boolean
33 34 35 |
# File 'lib/mail/fields/references_field.rb', line 33 def self.singular? true end |