Class: Mail::ReferencesField

Inherits:
CommonMessageIdField show all
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].message_ids #=> ['[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

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.



38
39
40
41
# File 'lib/mail/fields/references_field.rb', line 38

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

Returns:

  • (Boolean)


34
35
36
# File 'lib/mail/fields/references_field.rb', line 34

def self.singular?
  true
end