Module: Mail::CommonDate::InstanceMethods

Defined in:
lib/mail/fields/common/common_date.rb

Overview

:doc:

Instance Method Summary collapse

Instance Method Details

#date_timeObject

Returns a date time object of the parsed date

[View source]

8
9
10
# File 'lib/mail/fields/common/common_date.rb', line 8

def date_time
  ::DateTime.parse("#{element.date_string} #{element.time_string}")
end

#defaultObject

[View source]

12
13
14
# File 'lib/mail/fields/common/common_date.rb', line 12

def default
  date_time
end

#parse(val = value) ⇒ Object

[View source]

16
17
18
19
20
21
22
23
# File 'lib/mail/fields/common/common_date.rb', line 16

def parse(val = value)
  unless val.blank?
    @element = Mail::DateTimeElement.new(val)
    @tree = @element.tree
  else
    nil
  end
end