Class: Mail::StructuredField

Inherits:
Object
  • Object
show all
Includes:
CommonField, Utilities
Defined in:
lib/mail/fields/structured_field.rb

Overview

Provides access to a structured header field

Per RFC 2822:

2.2.2. Structured Header Field Bodies

   Some field bodies in this standard have specific syntactical
   structure more restrictive than the unstructured field bodies
   described above. These are referred to as "structured" field bodies.
   Structured field bodies are sequences of specific lexical tokens as
   described in sections 3 and 4 of this standard.  Many of these tokens
   are allowed (according to their syntax) to be introduced or end with
   comments (as described in section 3.2.3) as well as the space (SP,
   ASCII value 32) and horizontal tab (HTAB, ASCII value 9) characters
   (together known as the white space characters, WSP), and those WSP
   characters are subject to header "folding" and "unfolding" as
   described in section 2.2.3.  Semantic analysis of structured field
   bodies is given along with their syntax.

Direct Known Subclasses

BccField, CcField, ContentDispositionField, ContentIdField, ContentLocationField, ContentTransferEncodingField, ContentTypeField, DateField, Envelope, FromField, InReplyToField, KeywordsField, MessageIdField, MimeVersionField, ReceivedField, ReferencesField, ReplyToField, ResentBccField, ResentCcField, ResentDateField, ResentFromField, ResentMessageIdField, ResentSenderField, ResentToField, ReturnPathField, SenderField, ToField

Constant Summary

Constant Summary

Constants included from Patterns

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

Instance Method Summary (collapse)

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_parser, #uri_unescape

Methods included from CommonField

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

Constructor Details

- (StructuredField) initialize(name = nil, value = nil, charset = nil)



27
28
29
30
31
32
# File 'lib/mail/fields/structured_field.rb', line 27

def initialize(name = nil, value = nil, charset = nil)
  self.name    = name
  self.value   = value
  self.charset = charset
  self
end

Instance Method Details

- (Object) charset



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

def charset
  @charset
end

- (Object) charset=(val)



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

def charset=(val)
  @charset = val
end

- (Object) default



42
43
44
# File 'lib/mail/fields/structured_field.rb', line 42

def default
  decoded
end

- (Object) errors



46
47
48
# File 'lib/mail/fields/structured_field.rb', line 46

def errors
  []
end