@JRubyMethod(optional = 2, visibility = PRIVATE) public IRubyObject initialize(IRubyObject[]args, Block block) { status = RubyFixnum.zero(getRuntime()); if (args.length > 0 && args[0] instanceof RubyFixnum) { status = args[0]; IRubyObject[]tmpArgs = new IRubyObject[args.length - 1]; System.arraycopy(args, 1, tmpArgs, 0, tmpArgs.length); args = tmpArgs; } super.initialize(args, block); return this; }
@JRubyMethod(optional = 2, visibility = PRIVATE) public IRubyObject initialize(IRubyObject[]args, Block block) { status = RubyFixnum.zero(getRuntime()); if (args.length > 0 && args[0] instanceof RubyFixnum) { status = args[0]; IRubyObject[]tmpArgs = new IRubyObject[args.length - 1]; System.arraycopy(args, 1, tmpArgs, 0, tmpArgs.length); args = tmpArgs; } super.initialize(args, block); return this; }
@JRubyMethod(name = "initialize", optional = 2) @Override public IRubyObject initialize(IRubyObject[] args, Block block) { if (args.length > 1) { name = args[args.length - 1]; int newLength = args.length > 2 ? args.length - 2 : args.length - 1; IRubyObject []tmpArgs = new IRubyObject[newLength]; System.arraycopy(args, 0, tmpArgs, 0, newLength); args = tmpArgs; } else { name = getRuntime().getNil(); } super.initialize(args, block); return this; }
@JRubyMethod(name = "initialize", optional = 2) @Override public IRubyObject initialize(IRubyObject[] args, Block block) { if (args.length > 1) { name = args[args.length - 1]; int newLength = args.length > 2 ? args.length - 2 : args.length - 1; IRubyObject []tmpArgs = new IRubyObject[newLength]; System.arraycopy(args, 0, tmpArgs, 0, newLength); args = tmpArgs; } else { name = getRuntime().getNil(); } super.initialize(args, block); return this; }
@JRubyMethod(optional = 1) public RubyException exception(IRubyObject[] args) { switch (args.length) { case 0 : return this; case 1 : if (args[0] == this) return this; RubyException ret = (RubyException) rbClone(); ret.initialize(args, Block.NULL_BLOCK); // This looks wrong, but it's the way MRI does it. return ret; default : throw getRuntime().newArgumentError("Wrong argument count"); } }
@JRubyMethod(optional = 1) public RubyException exception(IRubyObject[] args) { switch (args.length) { case 0 : return this; case 1 : if (args[0] == this) return this; RubyException ret = (RubyException) rbClone(); ret.initialize(args, Block.NULL_BLOCK); // This looks wrong, but it's the way MRI does it. return ret; default : throw getRuntime().newArgumentError("Wrong argument count"); } }
@JRubyMethod(optional = 1) public RubyException exception(IRubyObject[] args) { switch (args.length) { case 0 : return this; case 1 : if(args[0] == this) { return this; } RubyException ret = (RubyException)rbClone(); ret.initialize(args, Block.NULL_BLOCK); // This looks wrong, but it's the way MRI does it. return ret; default : throw getRuntime().newArgumentError("Wrong argument count"); } }
@JRubyMethod(optional = 1) public RubyException exception(IRubyObject[] args) { switch (args.length) { case 0 : return this; case 1 : if(args[0] == this) { return this; } RubyException ret = (RubyException)rbClone(); ret.initialize(args, Block.NULL_BLOCK); // This looks wrong, but it's the way MRI does it. return ret; default : throw getRuntime().newArgumentError("Wrong argument count"); } }
@JRubyMethod(required = 1, optional = 2) @Override public IRubyObject initialize(IRubyObject[] args, Block block) { super.initialize(args, block); success = args.length >= 2 ? args[1] : getRuntime().getNil(); failed = args.length == 3 ? args[2] : getRuntime().getNil(); return this; }
@JRubyMethod(required = 1, optional = 2) @Override public IRubyObject initialize(IRubyObject[] args, Block block) { super.initialize(args, block); success = args.length >= 2 ? args[1] : getRuntime().getNil(); failed = args.length == 3 ? args[2] : getRuntime().getNil(); return this; }
@JRubyMethod(optional = 2, visibility = PRIVATE) @Override public IRubyObject initialize(IRubyObject[] args, Block block) { if (args.length > 0) { final IRubyObject arg = args[0]; if (arg instanceof RubyFixnum) { this.status = arg; if (args.length > 1) this.message = args[1]; // (status, message) } else if (arg instanceof RubyBoolean) { final Ruby runtime = getRuntime(); this.status = runtime.newFixnum( arg == runtime.getTrue() ? 0 : 1 ); if (args.length > 1) this.message = args[1]; // (status, message) } else { this.message = arg; this.status = RubyFixnum.zero(getRuntime()); } } else { this.status = RubyFixnum.zero(getRuntime()); } super.initialize(NULL_ARRAY, block); return this; }
@JRubyMethod(optional = 2, visibility = PRIVATE) @Override public IRubyObject initialize(IRubyObject[] args, Block block) { if (args.length > 0) { final IRubyObject arg = args[0]; if (arg instanceof RubyFixnum) { this.status = arg; if (args.length > 1) this.message = args[1]; // (status, message) } else if (arg instanceof RubyBoolean) { final Ruby runtime = getRuntime(); this.status = runtime.newFixnum( arg == runtime.getTrue() ? 0 : 1 ); if (args.length > 1) this.message = args[1]; // (status, message) } else { this.message = arg; this.status = RubyFixnum.zero(getRuntime()); } } else { this.status = RubyFixnum.zero(getRuntime()); } super.initialize(NULL_ARRAY, block); return this; }
super.initialize(new IRubyObject[]{sig}, block); this.signo = runtime.newFixnum(_signo);
super.initialize(new IRubyObject[]{sig}, block); this.signo = runtime.newFixnum(_signo);