Class: Superstore::Types::DateType
- Defined in:
- lib/superstore/types/date_type.rb
Constant Summary collapse
- FORMAT =
'%Y-%m-%d'
Instance Method Summary collapse
Methods inherited from Base
Instance Method Details
#cast_value(value) ⇒ Object
14 15 16 |
# File 'lib/superstore/types/date_type.rb', line 14 def cast_value(value) value.to_date rescue nil end |
#deserialize(str) ⇒ Object
10 11 12 |
# File 'lib/superstore/types/date_type.rb', line 10 def deserialize(str) Date.strptime(str, FORMAT) if str end |
#serialize(value) ⇒ Object
6 7 8 |
# File 'lib/superstore/types/date_type.rb', line 6 def serialize(value) value.strftime(FORMAT) if value end |