Class: Mail::ReceivedField

Inherits:
NamedStructuredField show all
Defined in:
lib/mail/fields/received_field.rb

Overview

trace = [return]

1*received

return = “Return-Path:” path CRLF

path = ([CFWS] “<” ([CFWS] / addr-spec) “>” [CFWS]) /

obs-path

received = “Received:” name-val-list “;” date-time CRLF

name-val-list = [CFWS] [name-val-pair *(CFWS name-val-pair)]

name-val-pair = item-name CFWS item-value

item-name = ALPHA *([“-”] (ALPHA / DIGIT))

item-value = 1*angle-addr / addr-spec /

atom / domain / msg-id

Constant Summary collapse

NAME =

:nodoc:

'Received'

Instance Attribute Summary

Attributes inherited from CommonField

#charset, #errors, #name, #value

Instance Method Summary collapse

Methods inherited from NamedStructuredField

#initialize

Methods inherited from CommonField

#decoded, #default, #encoded, #initialize, parse, #parse, #responsible_for?, #singular?, singular?, #to_s

Constructor Details

This class inherits a constructor from Mail::NamedStructuredField

Instance Method Details

#date_timeObject



31
32
33
# File 'lib/mail/fields/received_field.rb', line 31

def date_time
  @datetime ||= element.date_time
end

#elementObject



27
28
29
# File 'lib/mail/fields/received_field.rb', line 27

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

#formatted_dateObject



39
40
41
42
43
# File 'lib/mail/fields/received_field.rb', line 39

def formatted_date
  if date_time.respond_to? :strftime and date_time.respond_to? :zone
    date_time.strftime("%a, %d %b %Y %H:%M:%S ") + date_time.zone.delete(':')
  end
end

#infoObject



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

def info
  element.info
end