Skip to content

Commit 5c56c77

Browse files
committed
undo unwanted changes
1 parent ecdc128 commit 5c56c77

1 file changed

Lines changed: 6 additions & 13 deletions

File tree

lib/couchbase-orm/types/timestamp.rb

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,13 @@ module CouchbaseOrm
22
module Types
33
class Timestamp < ActiveModel::Type::DateTime
44
def cast(value)
5-
return nil if value.nil?
6-
7-
value = if value.is_a?(Integer) || value.is_a?(Float)
8-
Time.at(value)
9-
elsif value.is_a?(String) && value =~ /^[0-9]+$/
10-
Time.at(value.to_i)
11-
elsif value.is_a?(Time)
12-
value.utc
13-
else
14-
value
15-
end
16-
super(value)
5+
return nil if value.nil?
6+
return Time.at(value) if value.is_a?(Integer) || value.is_a?(Float)
7+
return Time.at(value.to_i) if value.is_a?(String) && value =~ /^[0-9]+$/
8+
return value.utc if value.is_a?(Time)
9+
super(value).utc
1710
end
18-
11+
1912
def serialize(value)
2013
value&.to_i
2114
end

0 commit comments

Comments
 (0)