@JRubyMethod(name = "parameters", compat = CompatVersion.RUBY1_9) public IRubyObject parameters(ThreadContext context) { return JRubyLibrary.MethodExtensions.methodArgs(this); } }
/** Create a Proc object. * */ @JRubyMethod public IRubyObject to_proc(ThreadContext context, Block unusedBlock) { Ruby runtime = context.runtime; CompiledBlockCallback19 callback = new CompiledBlockCallback19() { @Override public IRubyObject call(ThreadContext context, IRubyObject self, IRubyObject[] args, Block block) { return method.call(context, receiver, originModule, originName, args, block); } @Override public String getFile() { return getFilename(); } @Override public int getLine() { return RubyMethod.this.getLine(); } }; BlockBody body = CompiledBlockLight19.newCompiledBlockLight(method.getArity(), runtime.getStaticScopeFactory().getDummyScope(), callback, false, 0, JRubyLibrary.MethodExtensions.methodParameters(runtime, method)); Block b = new Block(body, context.currentBinding(receiver, Visibility.PUBLIC)); return RubyProc.newProc(runtime, b, Block.Type.LAMBDA); }
/** Create a Proc object. * */ @JRubyMethod public IRubyObject to_proc(ThreadContext context, Block unusedBlock) { Ruby runtime = context.runtime; CompiledBlockCallback19 callback = new CompiledBlockCallback19() { @Override public IRubyObject call(ThreadContext context, IRubyObject self, IRubyObject[] args, Block block) { return method.call(context, receiver, originModule, originName, args, block); } @Override public String getFile() { return getFilename(); } @Override public int getLine() { return RubyMethod.this.getLine(); } }; BlockBody body = CompiledBlockLight19.newCompiledBlockLight(method.getArity(), runtime.getStaticScopeFactory().getDummyScope(), callback, false, 0, JRubyLibrary.MethodExtensions.methodParameters(runtime, method)); Block b = new Block(body, context.currentBinding(receiver, Visibility.PUBLIC)); return RubyProc.newProc(runtime, b, Block.Type.LAMBDA); }
@JRubyMethod(name = "parameters", compat = CompatVersion.RUBY1_9) public IRubyObject parameters(ThreadContext context) { return JRubyLibrary.MethodExtensions.methodArgs(this); } }