Class: SerializableAttributes::Time
- Inherits:
-
AttributeType
- Object
- AttributeType
- SerializableAttributes::Time
- Defined in:
- lib/serializable_attributes/types.rb
Instance Method Summary collapse
Methods inherited from AttributeType
#default, #initialize, #type_for
Constructor Details
This class inherits a constructor from SerializableAttributes::AttributeType
Instance Method Details
#encode(input) ⇒ Object
70 |
# File 'lib/serializable_attributes/types.rb', line 70 def encode(input) input ? input.utc.xmlschema : nil end |
#parse(input) ⇒ Object
62 63 64 65 66 67 68 69 |
# File 'lib/serializable_attributes/types.rb', line 62 def parse(input) return nil if input.blank? case input when ::Time then input when ::String then ::Time.parse(input) else input.to_time end end |