Class: IknowParams::Serializer::ISO8601
- Inherits:
-
IknowParams::Serializer
- Object
- IknowParams::Serializer
- IknowParams::Serializer::ISO8601
- Defined in:
- lib/iknow_params/serializer.rb
Overview
Abstract serializer for ISO8601 dates and times
Instance Attribute Summary
Attributes inherited from IknowParams::Serializer
Instance Method Summary collapse
Methods inherited from IknowParams::Serializer
for, for!, #initialize, json_value?, #matches_type!, #matches_type?, singleton
Constructor Details
This class inherits a constructor from IknowParams::Serializer
Instance Method Details
#dump(val, json: nil) ⇒ Object
181 182 183 184 |
# File 'lib/iknow_params/serializer.rb', line 181 def dump(val, json: nil) matches_type!(val) val.iso8601 end |
#load(str) ⇒ Object
175 176 177 178 179 |
# File 'lib/iknow_params/serializer.rb', line 175 def load(str) clazz.parse(str) rescue TypeError, ArgumentError => _e raise LoadError.new("Invalid type for conversion to #{clazz}") end |