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 Patterns

Patterns::ATOM_UNSAFE, Patterns::CONTROL_CHAR, Patterns::CRLF, Patterns::FIELD_BODY, Patterns::FIELD_LINE, Patterns::FIELD_NAME, 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 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

#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.



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

#charsetObject



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

def charset
  @charset
end

#charset=(val) ⇒ Object



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

def charset=(val)
  @charset = val
end

#defaultObject



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

def default
  decoded
end

#errorsObject



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

def errors
  []
end