Class: Mail::UnstructuredField

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

Overview

Provides access to an unstructured header field

Per RFC 2822:

2.2.1. Unstructured Header Field Bodies

   Some field bodies in this standard are defined simply as
   "unstructured" (which is specified below as any US-ASCII characters,
   except for CR and LF) with no further restrictions.  These are
   referred to as unstructured field bodies.  Semantically, unstructured
   field bodies are simply to be treated as a single line of characters
   with no further processing (except for header "folding" and
   "unfolding" as described in section 2.2.3).

Instance Method Summary collapse

Methods included from Utilities

included

Methods included from CommonField

included

Constructor Details

#initialize(*args) ⇒ UnstructuredField

Returns a new instance of UnstructuredField.



20
21
22
23
24
# File 'lib/mail/fields/unstructured_field.rb', line 20

def initialize(*args)
  self.name = args.first
  self.value = args.last
  self
end

Instance Method Details

#decodedObject



30
31
32
# File 'lib/mail/fields/unstructured_field.rb', line 30

def decoded
  do_decode
end

#defaultObject



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

def default
  decoded
end

#encodedObject



26
27
28
# File 'lib/mail/fields/unstructured_field.rb', line 26

def encoded
  do_encode(self.name)
end

#parseObject

An unstructured field does not parse



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

def parse # An unstructured field does not parse
  self
end