Class: Quandl::Cassandra::Types::TimestampType
- Inherits:
-
AbstractType
- Object
- AbstractType
- Quandl::Cassandra::Types::TimestampType
- Defined in:
- lib/quandl/cassandra/types/timestamp_type.rb
Instance Attribute Summary
Attributes inherited from AbstractType
Class Method Summary collapse
Methods inherited from AbstractType
#initialize, quote_string, #sanitize, #sanitize_for_cql
Constructor Details
This class inherits a constructor from Quandl::Cassandra::Types::AbstractType
Class Method Details
.sanitize(value) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/quandl/cassandra/types/timestamp_type.rb', line 7 def self.sanitize(value) return value if value.is_a?(Time) return Time.at(value.get_time / 1000.0) if value.respond_to?(:get_time) Time.at(value.to_f) if value.present? rescue => error raise Quandl::Cassandra::Error::CastException.new("Unable to convert to #{name} #{value}", value) end |
.sanitize_for_cql(value) ⇒ Object
3 4 5 |
# File 'lib/quandl/cassandra/types/timestamp_type.rb', line 3 def self.sanitize_for_cql(value) (value.to_f * 1000).to_i end |