summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJosh Partlow <jpartlow@glatisant.org>2011-11-18 21:38:06 -0800
committerJosh Partlow <jpartlow@glatisant.org>2011-11-18 21:38:06 -0800
commita04856d8ea1bc5e98e9a8ef299dffd6bee365fc1 (patch)
tree7506dea7244f02bb6219ada1deb8ded6f84ddf9a /lib
parent4ee26ac90981bbe5d7b5114ddd5036a5cea24251 (diff)
downloadjson-a04856d8ea1bc5e98e9a8ef299dffd6bee365fc1.tar.gz
Fix for Time.json_create ensures == Time instances for roundtrip through JSON serialization in Ruby 1.9.2.
Diffstat (limited to 'lib')
-rw-r--r--lib/json/add/time.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/json/add/time.rb b/lib/json/add/time.rb
index abc807a..9755707 100644
--- a/lib/json/add/time.rb
+++ b/lib/json/add/time.rb
@@ -10,8 +10,8 @@ class Time
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