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.

Constant Summary

Constants included from Utilities

Utilities::CRLF, Utilities::CRLF_REGEX, Utilities::LF

Constants included from Constants

Constants::ASTERISK, Constants::ATOM_UNSAFE, Constants::B_VALUES, Constants::CAPITAL_M, Constants::COLON, Constants::CONTROL_CHAR, Constants::CR, Constants::CRLF, Constants::CR_ENCODED, Constants::EMPTY, Constants::ENCODED_VALUE, Constants::EQUAL_LF, Constants::FIELD_BODY, Constants::FIELD_LINE, Constants::FIELD_NAME, Constants::FIELD_PREFIX, Constants::FIELD_SPLIT, Constants::FULL_ENCODED_VALUE, Constants::FWS, Constants::HEADER_LINE, Constants::HEADER_SPLIT, Constants::HYPHEN, Constants::LF, Constants::LF_ENCODED, Constants::NULL_SENDER, Constants::PHRASE_UNSAFE, Constants::QP_SAFE, Constants::QP_UNSAFE, Constants::Q_VALUES, Constants::SPACE, Constants::TEXT, Constants::TOKEN_UNSAFE, Constants::UNDERSCORE, Constants::WSP

Instance Method Summary collapse

Methods included from Utilities

#atom_safe?, blank?, #bracket, #capitalize_field, #constantize, #dasherize, #dquote, #escape_paren, #map_lines, #map_with_index, #match_to_s, #paren, #quote_atom, #quote_phrase, #quote_token, to_crlf, to_lf, #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

#initialize(name = nil, value = nil, charset = nil) ⇒ StructuredField

Returns a new instance of StructuredField



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

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

Instance Method Details

#charsetObject



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

def charset
  @charset
end

#charset=(val) ⇒ Object



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

def charset=(val)
  @charset = val
end

#defaultObject



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

def default
  decoded
end

#errorsObject



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

def errors
  []
end