Class: Mail::Envelope

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

Instance Method Summary collapse

Methods inherited from StructuredField

#default

Methods included from Utilities

included

Methods included from CommonField

included

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