Module: CassandraObject::Types::TimeWithZoneType
- Defined in:
- lib/cassandra_object/types/time_with_zone_type.rb
Class Method Summary collapse
Class Method Details
.decode(str) ⇒ Object
10 11 12 13 14 |
# File 'lib/cassandra_object/types/time_with_zone_type.rb', line 10 def decode(str) return nil if str.empty? raise ArgumentError.new("Cannot convert #{str} into a Time") unless str.kind_of?(String) && str.match(TimeType::REGEX) Time.xmlschema(str).in_time_zone end |
.encode(time) ⇒ Object
4 5 6 7 |
# File 'lib/cassandra_object/types/time_with_zone_type.rb', line 4 def encode(time) raise ArgumentError.new("#{self} requires a Time") unless time.kind_of?(Time) time.utc.xmlschema(6) end |