Sha256: 89fdd043992787638b76ff8a4ab632e653fbec1bb92aae89ca4166aed3b429ae
Contents?: true
Size: 495 Bytes
Versions: 4
Compression:
Stored size: 495 Bytes
Contents
module Hari class Entity module Serialization module DateTime def self.serialize(value, options = {}) desserialize(value, options).try :iso8601 end def self.desserialize(value, options = {}) return unless value.present? value.kind_of?(::DateTime) ? value : ::DateTime.parse(value) rescue raise SerializationError, "#{options[:name]}:#{value} is an invalid date time" end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems