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



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

def date_time
  @datetime ||= element.date_time
end

#elementObject



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

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

#formatted_dateObject



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

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



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

def info
  element.info
end