Class: CassandraObject::Types::TimeType
- Inherits:
-
BaseType
- Object
- BaseType
- CassandraObject::Types::TimeType
show all
- Defined in:
- lib/cassandra_object/types/time_type.rb
Instance Attribute Summary
Attributes inherited from BaseType
#options
Instance Method Summary
collapse
Methods inherited from BaseType
#default, #initialize, #wrap
Instance Method Details
#decode(str) ⇒ Object
9
10
11
12
13
|
# File 'lib/cassandra_object/types/time_type.rb', line 9
def decode(str)
Time.parse(str).utc if str
rescue
end
|
#encode(time) ⇒ Object
4
5
6
7
|
# File 'lib/cassandra_object/types/time_type.rb', line 4
def encode(time)
raise ArgumentError.new("#{time.inspect} is not a Time") unless time.kind_of?(Time)
time.utc.xmlschema(6)
end
|