Skip to content

Commit

Permalink
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions core/src/main/java/org/jruby/java/proxies/MapJavaProxy.java
Original file line number Diff line number Diff line change
@@ -44,11 +44,11 @@
import org.jruby.runtime.ThreadContext;
import org.jruby.runtime.Visibility;
import org.jruby.runtime.builtin.IRubyObject;
import org.jruby.runtime.invokedynamic.MethodNames;

import java.util.Collection;
import java.util.Map;
import java.util.Set;
import org.jruby.util.TypeConverter;

/**
* A proxy for wrapping <code>java.util.Map</code> instances.
@@ -448,7 +448,11 @@ public RubyArray to_a() {

@JRubyMethod(name = "to_proc")
public RubyProc to_proc(ThreadContext context) {
return getOrCreateRubyHashMap().to_proc(context);
IRubyObject newProc = getOrCreateRubyHashMap().callMethod("to_proc");

TypeConverter.checkType(context, newProc, context.runtime.getProc());

return (RubyProc) newProc;
}

/** rb_hash_to_s

1 comment on commit 01401a7

@kares
Copy link
Member

@kares kares commented on 01401a7 Aug 12, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking good, would leave it as is for now (can always add call-site caching later).

Please sign in to comment.