Class: Mail::ReceivedField
- Inherits:
-
StructuredField
- Object
- StructuredField
- Mail::ReceivedField
- Defined in:
- lib/mail/fields/received_field.rb
Constant Summary collapse
- FIELD_NAME =
'received'
- CAPITALIZED_FIELD =
'Received'
Instance Method Summary collapse
- #date_time ⇒ Object
- #decoded ⇒ Object
- #element ⇒ Object
- #encoded ⇒ Object
- #info ⇒ Object
-
#initialize(*args) ⇒ ReceivedField
constructor
A new instance of ReceivedField.
- #parse(val = value) ⇒ Object
Methods inherited from StructuredField
Methods included from Utilities
Methods included from CommonField
Constructor Details
#initialize(*args) ⇒ ReceivedField
Returns a new instance of ReceivedField.
28 29 30 31 32 33 |
# File 'lib/mail/fields/received_field.rb', line 28 def initialize(*args) super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, args.last)) self.parse self end |
Instance Method Details
#date_time ⇒ Object
45 46 47 |
# File 'lib/mail/fields/received_field.rb', line 45 def date_time ::DateTime.parse("#{element.date_time}") end |
#decoded ⇒ Object
57 58 59 |
# File 'lib/mail/fields/received_field.rb', line 57 def decoded value end |
#element ⇒ Object
41 42 43 |
# File 'lib/mail/fields/received_field.rb', line 41 def element @element ||= Mail::ReceivedElement.new(value) end |
#encoded ⇒ Object
53 54 55 |
# File 'lib/mail/fields/received_field.rb', line 53 def encoded "#{CAPITALIZED_FIELD}: #{value}" end |
#info ⇒ Object
49 50 51 |
# File 'lib/mail/fields/received_field.rb', line 49 def info element.info end |
#parse(val = value) ⇒ Object
35 36 37 38 39 |
# File 'lib/mail/fields/received_field.rb', line 35 def parse(val = value) unless val.blank? @element = Mail::ReceivedElement.new(val) end end |