lib/json/add/time.rb in json_pure-1.6.1 vs lib/json/add/time.rb in json_pure-1.6.2
- old
+ new
@@ -8,11 +8,11 @@
# Deserializes JSON string by converting time since epoch to Time
def self.json_create(object)
if usec = object.delete('u') # used to be tv_usec -> tv_nsec
object['n'] = usec * 1000
end
- if respond_to?(:tv_nsec)
- at(*object.values_at('s', 'n'))
+ if instance_methods.include?(:tv_nsec)
+ at(object['s'], Rational(object['n'], 1000))
else
at(object['s'], object['n'] / 1000)
end
end