Sha256: 1404fd22f4166af6f433df97bb3dbe1509d01beaf3566fa41d59fca03080fc70
Contents?: true
Size: 576 Bytes
Versions: 17
Compression:
Stored size: 576 Bytes
Contents
class RestModel module Serialization class DateTime def self.serialize(value) ::DateTime.parse value rescue raise SerializationError, "value '#{value}' is an invalid date time" end def self.desserialize(value) date_time = value.kind_of?(::DateTime) ? value : ::DateTime.parse(value) format = RestModel::Configuration.date_time_format format ? date_time.strftime(format) : date_time.to_s rescue raise SerializationError, "value '#{value}' is an invalid date time" end end end end
Version data entries
17 entries across 17 versions & 1 rubygems