Class: Mail::MessageIdField

Inherits:
StructuredField show all
Includes:
CommonMessageId
Defined in:
lib/mail/fields/message_id_field.rb

Constant Summary collapse

FIELD_NAME =
'message-id'
CAPITALIZED_FIELD =
'Message-ID'

Instance Method Summary collapse

Methods included from CommonMessageId

included

Methods inherited from StructuredField

#default

Methods included from Utilities

included

Methods included from CommonField

included

Constructor Details

#initialize(*args) ⇒ MessageIdField

Returns a new instance of MessageIdField.



39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/mail/fields/message_id_field.rb', line 39

def initialize(*args)
  @uniq = 1
  if args.last.blank?
    self.name = CAPITALIZED_FIELD
    self.value = generate_message_id
  else
    super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, args.last))
  end
  self.parse
  self

end

Instance Method Details

#decodedObject



68
69
70
# File 'lib/mail/fields/message_id_field.rb', line 68

def decoded
  do_decode
end

#encodedObject



64
65
66
# File 'lib/mail/fields/message_id_field.rb', line 64

def encoded
  do_encode(CAPITALIZED_FIELD)
end

#message_idsObject



56
57
58
# File 'lib/mail/fields/message_id_field.rb', line 56

def message_ids
  [message_id]
end

#nameObject



52
53
54
# File 'lib/mail/fields/message_id_field.rb', line 52

def name
  'Message-ID'
end

#to_sObject



60
61
62
# File 'lib/mail/fields/message_id_field.rb', line 60

def to_s
  "<#{message_id}>"
end