public ArgumentDescriptor[] getArgumentDescriptors() { return delegate instanceof IRMethodArgs ? ((IRMethodArgs) delegate).getArgumentDescriptors() : Helpers.methodToArgumentDescriptors(delegate); } }
public Signature getSignature() { return delegate instanceof IRMethodArgs ? ((IRMethodArgs) delegate).getSignature() : Signature.from(delegate.getArity()); }
/** Create a Proc object. * */ @JRubyMethod public IRubyObject to_proc(ThreadContext context) { Ruby runtime = context.runtime; MethodBlockBody body; Signature signature; ArgumentDescriptor[] argsDesc; if (method instanceof IRMethodArgs) { signature = ((IRMethodArgs) method).getSignature(); argsDesc = ((IRMethodArgs) method).getArgumentDescriptors(); } else { signature = Signature.from(method.getArity()); argsDesc = Helpers.methodToArgumentDescriptors(method); } int line = getLine(); // getLine adds 1 to 1-index but we need to reset to 0-index internally body = new MethodBlockBody(runtime.getStaticScopeFactory().getDummyScope(), signature, method, argsDesc, receiver, originModule, originName, getFilename(), line == -1 ? -1 : line - 1); Block b = MethodBlockBody.createMethodBlock(body); return RubyProc.newProc(runtime, b, Block.Type.LAMBDA); }
for (String[] argParam: ((IRMethodArgs)method).getParameterList()) { RubySymbol argType = runtime.newSymbol(argParam[0]); if (argParam[1] == "") argsArray.add(argParam[0]);
/** Create a Proc object. * */ @JRubyMethod public IRubyObject to_proc(ThreadContext context) { Ruby runtime = context.runtime; MethodBlockBody body; Signature signature; ArgumentDescriptor[] argsDesc; if (method instanceof IRMethodArgs) { signature = ((IRMethodArgs) method).getSignature(); argsDesc = ((IRMethodArgs) method).getArgumentDescriptors(); } else { signature = Signature.from(method.getArity()); argsDesc = Helpers.methodToArgumentDescriptors(method); } int line = getLine(); // getLine adds 1 to 1-index but we need to reset to 0-index internally body = new MethodBlockBody(runtime.getStaticScopeFactory().getDummyScope(), signature, method, argsDesc, receiver, originModule, originName, getFilename(), line == -1 ? -1 : line - 1); Block b = MethodBlockBody.createMethodBlock(body); return RubyProc.newProc(runtime, b, Block.Type.LAMBDA); }
for (String[] argParam: ((IRMethodArgs)method).getParameterList()) { RubySymbol argType = runtime.newSymbol(argParam[0]); if (argParam[1] == "") argsArray.add(argParam[0]);
public Signature getSignature() { return delegate instanceof IRMethodArgs ? ((IRMethodArgs) delegate).getSignature() : Signature.from(delegate.getArity()); }
public ArgumentDescriptor[] getArgumentDescriptors() { return delegate instanceof IRMethodArgs ? ((IRMethodArgs) delegate).getArgumentDescriptors() : Helpers.methodToArgumentDescriptors(delegate); } }
for (String[] argParam: ((IRMethodArgs)method).getParameterList()) { RubySymbol argType = runtime.newSymbol(argParam[0]); if (argParam[1] == "") argsArray.append(RubyArray.newArray(runtime, argType));
/** Returns the number of arguments a method accepted. * * @return the number of arguments of a method. */ @JRubyMethod(name = "arity") public RubyFixnum arity() { int value; if (method instanceof IRMethodArgs) { value = ((IRMethodArgs) method).getSignature().arityValue(); } else { value = method.getArity().getValue(); } return getRuntime().newFixnum(value); }
public static ArgumentDescriptor[] methodToArgumentDescriptors(DynamicMethod method) { method = method.getRealMethod(); if (method instanceof MethodArgs2) { return parameterListToArgumentDescriptors(method.getImplementationClass().getRuntime(), ((MethodArgs2) method).getParameterList(), true); } else if (method instanceof IRMethodArgs) { return ((IRMethodArgs) method).getArgumentDescriptors(); } else { return new ArgumentDescriptor[]{new ArgumentDescriptor(ArgumentType.anonrest)}; } }
for (String[] argParam: ((IRMethodArgs)method).getParameterList()) { RubySymbol argType = runtime.newSymbol(argParam[0]); if (argParam[1] == "") argsArray.append(RubyArray.newArray(runtime, argType));
/** Returns the number of arguments a method accepted. * * @return the number of arguments of a method. */ @JRubyMethod public RubyFixnum arity() { int value; if (method instanceof IRMethodArgs) { value = ((IRMethodArgs) method).getSignature().arityValue(); } else { value = method.getArity().getValue(); } return getRuntime().newFixnum(value); }
public static ArgumentDescriptor[] methodToArgumentDescriptors(DynamicMethod method) { method = method.getRealMethod(); if (method instanceof MethodArgs2) { return parameterListToArgumentDescriptors(method.getImplementationClass().getRuntime(), ((MethodArgs2) method).getParameterList(), true); } else if (method instanceof IRMethodArgs) { return ((IRMethodArgs) method).getArgumentDescriptors(); } else { return new ArgumentDescriptor[]{new ArgumentDescriptor(ArgumentType.anonrest)}; } }
/** Returns the number of arguments a method accepted. * * @return the number of arguments of a method. */ @JRubyMethod public RubyFixnum arity() { int value; if (method instanceof IRMethodArgs) { value = ((IRMethodArgs) method).getSignature().arityValue(); } else { value = method.getArity().getValue(); } return getRuntime().newFixnum(value); }
/** Returns the number of arguments a method accepted. * * @return the number of arguments of a method. */ @JRubyMethod(name = "arity") public RubyFixnum arity() { int value; if (method instanceof IRMethodArgs) { value = ((IRMethodArgs) method).getSignature().arityValue(); } else { value = method.getArity().getValue(); } return getRuntime().newFixnum(value); }