1
0
Fork 0
mirror of https://github.com/rails/execjs synced 2023-03-27 23:21:20 -04:00

Merge pull request #84 from weppos/multijson-api

Fix invalid MultiJson API detection (closes #82)
This commit is contained in:
Joshua Peek 2012-05-07 07:59:34 -07:00
commit 1809ef6910

View file

@ -85,21 +85,19 @@ module ExecJS
end end
end end
if MultiJson.respond_to?(:load) if MultiJson.respond_to?(:dump)
def json_decode(obj) def json_decode(obj)
MultiJson.load(obj) MultiJson.load(obj)
end end
else
def json_decode(obj)
MultiJson.decode(obj)
end
end
if MultiJson.respond_to?(:dump)
def json_encode(obj) def json_encode(obj)
MultiJson.dump(obj) MultiJson.dump(obj)
end end
else else
def json_decode(obj)
MultiJson.decode(obj)
end
def json_encode(obj) def json_encode(obj)
MultiJson.encode(obj) MultiJson.encode(obj)
end end