Sha256: fd72e5ae305acfede023d6245c8eb81f5582f5e135ec87a455dc45aeef7efd22
Contents?: true
Size: 847 Bytes
Versions: 2
Compression:
Stored size: 847 Bytes
Contents
# coding: utf-8 # frozen_string_literal: true ################################################ # © Alexander Semyonov, 2011—2013, MIT License # # Author: Alexander Semyonov <al@semyonov.us> # ################################################ require 'xommelier' module Xommelier module Common # A date-time displayed in RFC 822 format. class Time822 < Time def self.from_xommelier(value) return unless value case value when String value = begin rfc2822(value) rescue parse(value) end at(value) when Time, Date, DateTime at(value.to_time) else raise TypeError.new(value, self) end end def to_xommelier utc.rfc822 end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
xommelier-0.1.34 | lib/xommelier/common.rb |
xommelier-0.1.33 | lib/xommelier/common.rb |