Class: Mail::Envelope

Inherits:
StructuredField show all
Defined in:
lib/mail/envelope.rb

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

Methods included from CommonField

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

Constructor Details

#initialize(*args) ⇒ Envelope

Returns a new instance of Envelope.



13
14
15
# File 'lib/mail/envelope.rb', line 13

def initialize(*args)
  super(FIELD_NAME, strip_field(FIELD_NAME, args.last))
end

Instance Method Details

#dateObject



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

def date
  ::DateTime.parse("#{element.date_time}")
end

#elementObject



22
23
24
# File 'lib/mail/envelope.rb', line 22

def element
  @element ||= Mail::EnvelopeFromElement.new(value)
end

#fromObject



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

def from
  element.address
end

#treeObject



17
18
19
20
# File 'lib/mail/envelope.rb', line 17

def tree
  @element ||= Mail::EnvelopeFromElement.new(value)
  @tree ||= @element.tree
end