Class: Mail::InReplyToField

Inherits:
CommonMessageIdField show all
Defined in:
lib/mail/fields/in_reply_to_field.rb

Overview

In-Reply-To Field

The In-Reply-To field inherits from StructuredField and handles the In-Reply-To: header field in the email.

Sending in_reply_to to a mail message will instantiate a Mail::Field object that has a InReplyToField as its field type. This includes all Mail::CommonMessageId 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 InReplyTo field can appear in a header, though it can have multiple Message IDs.

Examples:

mail = Mail.new
mail.in_reply_to = '<[email protected]>'
mail.in_reply_to    #=> '<[email protected]>'
mail[:in_reply_to]  #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::InReplyToField:0x180e1c4
mail['in_reply_to'] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::InReplyToField:0x180e1c4
mail['In-Reply-To'] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::InReplyToField:0x180e1c4

mail[:in_reply_to].message_ids #=> ['[email protected]']

Constant Summary collapse

NAME =

:nodoc:

'In-Reply-To'

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) ⇒ InReplyToField

Returns a new instance of InReplyToField.



38
39
40
41
42
43
44
# File 'lib/mail/fields/in_reply_to_field.rb', line 38

def initialize(value = nil, charset = nil)
  if value.is_a?(Array)
    super value.join("\r\n\s"), charset
  else
    super
  end
end

Class Method Details

.singular?Boolean

Returns:

  • (Boolean)


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

def self.singular?
  true
end