private static Binding getBindingForEval(ThreadContext context, IRubyObject scope) { if (scope instanceof RubyBinding) { return ((RubyBinding) scope).getBinding().cloneForEval(); } throw context.runtime.newTypeError("wrong argument type " + scope.getMetaClass() + " (expected binding)"); }
private static Binding getBindingForEval(ThreadContext context, IRubyObject scope) { if (scope instanceof RubyBinding) { return ((RubyBinding) scope).getBinding().cloneForEval(); } throw context.runtime.newTypeError("wrong argument type " + scope.getMetaClass() + " (expected binding)"); }
@Override public Binding convertToBinding(IRubyObject scope) { if (scope instanceof RubyBinding) { return ((RubyBinding)scope).getBinding().cloneForEval(); } else { if (scope instanceof RubyProc) { return ((RubyProc) scope).getBlock().getBinding().cloneForEval(); } else { // bomb out, it's not a binding or a proc throw scope.getRuntime().newTypeError("wrong argument type " + scope.getMetaClass() + " (expected Proc/Binding)"); } } } };
@Override public Binding convertToBinding(IRubyObject scope) { if (scope instanceof RubyBinding) { return ((RubyBinding)scope).getBinding().cloneForEval(); } else { if (scope instanceof RubyProc) { return ((RubyProc) scope).getBlock().getBinding().cloneForEval(); } else { // bomb out, it's not a binding or a proc throw scope.getRuntime().newTypeError("wrong argument type " + scope.getMetaClass() + " (expected Proc/Binding)"); } } } };
@Override public Binding convertToBinding(IRubyObject scope) { if (scope instanceof RubyBinding) { return ((RubyBinding)scope).getBinding().cloneForEval(); } else { throw scope.getRuntime().newTypeError("wrong argument type " + scope.getMetaClass() + " (expected Binding)"); } } };
@Override public Binding convertToBinding(IRubyObject scope) { if (scope instanceof RubyBinding) { return ((RubyBinding)scope).getBinding().cloneForEval(); } else { throw scope.getRuntime().newTypeError("wrong argument type " + scope.getMetaClass() + " (expected Binding)"); } } };