Class: Cequel::Type::Date

Inherits:
Base
  • Object
show all
Defined in:
lib/cequel/type.rb

Overview

‘date` columns store dates.

See Also:

Since:

  • 1.0.0

Instance Method Summary collapse

Methods inherited from Base

#compatible_types, #cql_aliases, #cql_name, #internal_name, #to_s

Instance Method Details

#cast(value) ⇒ Object

Since:

  • 1.0.0



415
416
417
418
419
420
# File 'lib/cequel/type.rb', line 415

def cast(value)
  if value.is_a?(::String) then ::Date.parse(value)
  elsif value.respond_to?(:to_date) then value.to_date
  else ::Date.parse(value.to_s)
  end
end

#internal_namesObject

Since:

  • 1.0.0



411
412
413
# File 'lib/cequel/type.rb', line 411

def internal_names
  ['org.apache.cassandra.db.marshal.DateType']
end