Class: Superstore::Types::TimeType
- Defined in:
- lib/superstore/types/time_type.rb
Instance Method Summary collapse
Methods inherited from Base
Instance Method Details
#cast_value(value) ⇒ Object
14 15 16 |
# File 'lib/superstore/types/time_type.rb', line 14 def cast_value(value) value.to_time.in_time_zone rescue nil end |
#deserialize(str) ⇒ Object
8 9 10 11 12 |
# File 'lib/superstore/types/time_type.rb', line 8 def deserialize(str) Time.rfc3339(str).in_time_zone if str rescue ArgumentError Time.parse(str).in_time_zone rescue nil end |
#serialize(time) ⇒ Object
4 5 6 |
# File 'lib/superstore/types/time_type.rb', line 4 def serialize(time) time.utc.xmlschema(6) if time end |