diff options
Diffstat (limited to 'java/src/json/ext/OptionsReader.java')
-rw-r--r-- | java/src/json/ext/OptionsReader.java | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/java/src/json/ext/OptionsReader.java b/java/src/json/ext/OptionsReader.java index 6835735..8212503 100644 --- a/java/src/json/ext/OptionsReader.java +++ b/java/src/json/ext/OptionsReader.java @@ -24,13 +24,14 @@ final class OptionsReader { OptionsReader(ThreadContext context, IRubyObject vOpts) { this.context = context; this.runtime = context.getRuntime(); - if (vOpts == null || vOpts.isNil()) { opts = null; } else if (vOpts.respondsTo("to_hash")) { opts = vOpts.convertToHash(); - } else { + } else if (vOpts.respondsTo("to_h")) { opts = vOpts.callMethod(context, "to_h").convertToHash(); + } else { + opts = vOpts.convertToHash(); /* Should just raise the correct TypeError */ } } |