Sha256: b633a8006366e1c8ab10f618e440c3009d67ee4033b116cc0e166b4f105cc471
Contents?: true
Size: 478 Bytes
Versions: 7
Compression:
Stored size: 478 Bytes
Contents
module CassandraObject module Types class DateType < BaseType FORMAT = '%Y-%m-%d' REGEX = /\A\d{4}-\d{2}-\d{2}\Z/ def encode(value) raise ArgumentError.new("#{value.inspect} is not a Date") unless value.kind_of?(Date) value.strftime(FORMAT) end def decode(str) return nil if str.empty? Date.parse(str) end def wrap(record, name, value) value.to_date if value end end end end
Version data entries
7 entries across 7 versions & 1 rubygems