Class: Xommelier::Common::Time822

Inherits:
Time
  • Object
show all
Defined in:
lib/xommelier/common.rb

Overview

A date-time displayed in RFC 822 format.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_xommelier(value) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/xommelier/common.rb', line 14

def self.from_xommelier(value)
  return unless value
  case value
  when String
    value = begin
              rfc2822(value)
            rescue StandardError
              parse(value)
            end
    at(value)
  when Time, Date, DateTime
    at(value.to_time)
  else
    raise TypeError.new(value, self)
  end
end

Instance Method Details

#to_xommelierObject



31
32
33
# File 'lib/xommelier/common.rb', line 31

def to_xommelier
  utc.rfc822
end