Sha256: 8da62d8ee09292dac841fd69dbeaf8924e15ebb7acce3de3a239183403fd8624

Contents?: true

Size: 782 Bytes

Versions: 3

Compression:

Stored size: 782 Bytes

Contents

# encoding: utf-8
# 
# resent-date     =       "Resent-Date:" date-time CRLF
require 'mail/fields/common/common_date'

module Mail
  class ResentDateField < StructuredField
    
    include Mail::CommonDate
    
    FIELD_NAME = 'resent-date'
    CAPITALIZED_FIELD = 'Resent-Date'
    
    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
    
    def encoded
      do_encode(CAPITALIZED_FIELD)
    end
    
    def decoded
      do_decode
    end
    
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mail-2.1.5.3 lib/mail/fields/resent_date_field.rb
mail-2.1.5.2 lib/mail/fields/resent_date_field.rb
mail-2.1.5.1 lib/mail/fields/resent_date_field.rb