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'

Constants included from Patterns

Patterns::ATOM_UNSAFE, Patterns::CONTROL_CHAR, Patterns::CRLF, Patterns::FIELD_BODY, Patterns::FIELD_LINE, Patterns::FWS, Patterns::HEADER_LINE, Patterns::PHRASE_UNSAFE, Patterns::QP_SAFE, Patterns::QP_UNSAFE, Patterns::TEXT, Patterns::TOKEN_UNSAFE, Patterns::WSP

Instance Method Summary collapse

Methods included from CommonMessageId

#default, #element, #message_id, #parse

Methods inherited from StructuredField

#charset, #charset=, #default, #errors

Methods included from Utilities

#atom_safe?, #bracket, #capitalize_field, #constantize, #dasherize, #dquote, #escape_paren, #map_lines, #map_with_index, #match_to_s, #paren, #quote_atom, #quote_phrase, #quote_token, #token_safe?, #unbracket, #underscoreize, #unparen, #unquote, #uri_escape, #uri_unescape

Methods included from CommonField

#default, #field_length, #name=, #responsible_for?, #value, #value=

Constructor Details

#initialize(value = nil, charset = 'utf-8') ⇒ MessageIdField

Returns a new instance of MessageIdField.



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

def initialize(value = nil, charset = 'utf-8')
  self.charset = charset
  @uniq = 1
  if value.blank?
    self.name = CAPITALIZED_FIELD
    self.value = generate_message_id
  else
    super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, value), charset)
  end
  self.parse
  self

end

Instance Method Details

#decodedObject



71
72
73
# File 'lib/mail/fields/message_id_field.rb', line 71

def decoded
  do_decode
end

#encodedObject



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

def encoded
  do_encode(CAPITALIZED_FIELD)
end

#message_idsObject



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

def message_ids
  [message_id]
end

#nameObject



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

def name
  'Message-ID'
end

#to_sObject



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

def to_s
  "<#{message_id}>"
end