Class: Mail::DateField
- Inherits:
-
StructuredField
- Object
- StructuredField
- Mail::DateField
- Includes:
- CommonDate
- Defined in:
- lib/mail/fields/date_field.rb
Constant Summary collapse
- FIELD_NAME =
'date'
- CAPITALIZED_FIELD =
"Date"
Instance Method Summary collapse
- #decoded ⇒ Object
- #encoded ⇒ Object
-
#initialize(*args) ⇒ DateField
constructor
A new instance of DateField.
Methods included from CommonDate
Methods inherited from StructuredField
Methods included from Utilities
Methods included from CommonField
Constructor Details
#initialize(*args) ⇒ DateField
Returns a new instance of DateField.
32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/mail/fields/date_field.rb', line 32 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
#decoded ⇒ Object
48 49 50 |
# File 'lib/mail/fields/date_field.rb', line 48 def decoded do_decode end |
#encoded ⇒ Object
44 45 46 |
# File 'lib/mail/fields/date_field.rb', line 44 def encoded do_encode(CAPITALIZED_FIELD) end |