Class: Mirah::Serializers::DateTimeSerializer
- Inherits:
-
Object
- Object
- Mirah::Serializers::DateTimeSerializer
- Defined in:
- lib/mirah/serializers.rb
Overview
Serialize types for a date time in ISO 8601 format.
Instance Method Summary collapse
Instance Method Details
#deserialize(value) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/mirah/serializers.rb', line 43 def deserialize(value) case value when DateTime value when Date DateTime.parse(value.to_s) when ::String DateTime.parse(value) end rescue StandardError nil end |
#serialize(value) ⇒ Object
39 40 41 |
# File 'lib/mirah/serializers.rb', line 39 def serialize(value) value&.iso8601 end |