Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'multi_json_fix' into extends_and_additionalProperties_p…

…roblem
  • Loading branch information...
commit ccb3ad4df261b54aa50d7ae3dd567c56b0ffaea6 2 parents 986afce + 0c5ab31
@japgolly authored
Showing with 4 additions and 4 deletions.
  1. +4 −4 lib/json-schema/validator.rb
View
8 lib/json-schema/validator.rb
@@ -363,7 +363,7 @@ def register_default_validator(v)
def json_backend
if defined?(MultiJson)
- MultiJson.engine
+ MultiJson.respond_to?(:adapter) ? MultiJson.adapter : MultiJson.engine
else
@@json_backend
end
@@ -372,7 +372,7 @@ def json_backend
def json_backend=(backend)
if defined?(MultiJson)
backend = backend == 'json' ? 'json_gem' : backend
- MultiJson.engine = backend
+ MultiJson.respond_to?(:use) ? MultiJson.use(backend) : MultiJson.engine = backend
else
backend = backend.to_s
if @@available_json_backends.include?(backend)
@@ -385,7 +385,7 @@ def json_backend=(backend)
def parse(s)
if defined?(MultiJson)
- MultiJson.decode(s)
+ MultiJson.respond_to?(:load) ? MultiJson.load(s) : MultiJson.decode(s)
else
case @@json_backend.to_s
when 'json'
@@ -451,7 +451,7 @@ def parse(s)
def serialize schema
if defined?(MultiJson)
- MultiJson.encode(schema)
+ MultiJson.respond_to?(:dump) ? MultiJson.dump(schema) : MultiJson.encode(schema)
else
@@serializer.call(schema)
end
Please sign in to comment.
Something went wrong with that request. Please try again.