Sha256: c081dd45936ea77bce18ff3aeeb573c1046eea19a6714d23db3b2c8b5d0b9a11

Contents?: true

Size: 740 Bytes

Versions: 14

Compression:

Stored size: 740 Bytes

Contents

# encoding: utf-8
# 
# resent-date     =       "Resent-Date:" date-time CRLF
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

14 entries across 14 versions & 2 rubygems

Version Path
mail-2.1.5 lib/mail/fields/resent_date_field.rb
mail-2.1.3 lib/mail/fields/resent_date_field.rb
kbaum-mail-2.1.2.1 lib/mail/fields/resent_date_field.rb
mail-2.1.2 lib/mail/fields/resent_date_field.rb
mail-2.1.1 lib/mail/fields/resent_date_field.rb
mail-2.1.0 lib/mail/fields/resent_date_field.rb
mail-2.0.5 lib/mail/fields/resent_date_field.rb
mail-2.0.3 lib/mail/fields/resent_date_field.rb
mail-1.6.0 lib/mail/fields/resent_date_field.rb
mail-1.5.4 lib/mail/fields/resent_date_field.rb
mail-1.5.3 lib/mail/fields/resent_date_field.rb
mail-1.5.2 lib/mail/fields/resent_date_field.rb
mail-1.5.1 lib/mail/fields/resent_date_field.rb
mail-1.5.0 lib/mail/fields/resent_date_field.rb