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