lib/json/add/time.rb in json_pure-1.8.1 vs lib/json/add/time.rb in json_pure-1.8.2
- old
+ new
@@ -8,10 +8,10 @@
# 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 instance_methods.include?(:tv_nsec)
+ if method_defined?(:tv_nsec)
at(object['s'], Rational(object['n'], 1000))
else
at(object['s'], object['n'] / 1000)
end
end