Class: Mail::ResentDateField

Inherits:
StructuredField show all
Includes:
CommonDate
Defined in:
lib/mail/fields/resent_date_field.rb

Constant Summary collapse

FIELD_NAME =
'resent-date'
CAPITALIZED_FIELD =
'Resent-Date'

Instance Method Summary collapse

Methods included from CommonDate

included

Methods inherited from StructuredField

#default

Methods included from Utilities

included

Methods included from CommonField

included

Constructor Details

#initialize(*args) ⇒ ResentDateField

Returns a new instance of ResentDateField.



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/mail/fields/resent_date_field.rb', line 12

def initialize(*args)
  if args.last.blank?
    self.name = CAPITALIZED_FIELD
    self.value = Time.now.strftime('%a, %d %b %Y %H:%M:%S %z')
    self
  else
    value = strip_field(FIELD_NAME, args.last)
    value = ::DateTime.parse(value.to_s).strftime('%a, %d %b %Y %H:%M:%S %z')
    super(CAPITALIZED_FIELD, value)
  end
end

Instance Method Details

#decodedObject



28
29
30
# File 'lib/mail/fields/resent_date_field.rb', line 28

def decoded
  do_decode
end

#encodedObject



24
25
26
# File 'lib/mail/fields/resent_date_field.rb', line 24

def encoded
  do_encode(CAPITALIZED_FIELD)
end