@Deprecated public IRubyObject aref19(IRubyObject arg0) { return aref(arg0); }
@Deprecated public IRubyObject aref19(IRubyObject arg0, IRubyObject arg1) { return aref(arg0, arg1); }
@JRubyMethod(name = "[]", required = 2) public static IRubyObject aref(final ThreadContext context, final IRubyObject self, final IRubyObject arg0, final IRubyObject arg1) { return to_a(context, self).aref(arg0, arg1); }
@JRubyMethod(name = "[]", required = 2) public static IRubyObject aref(final ThreadContext context, final IRubyObject self, final IRubyObject arg0, final IRubyObject arg1) { return to_a(context, self).aref(arg0, arg1); }
@Override public IRubyObject call(ThreadContext context, IRubyObject caller, IRubyObject self, IRubyObject arg) { if (self.getMetaClass() == context.runtime.getArray()) { return ((RubyArray) self).aref(arg); } return super.call(context, caller, self, arg); } }
@JRubyMethod(name = "[]", required = 1) public static IRubyObject aref(final ThreadContext context, final IRubyObject self, final IRubyObject idx) { final java.util.regex.Matcher matcher = unwrapJavaObject(self); if ( idx instanceof RubySymbol || idx instanceof RubyString ) { return context.runtime.newString( matcher.group(idx.toString()) ); } if ( idx instanceof RubyInteger ) { final int group = ((RubyInteger) idx).getIntValue(); return context.runtime.newString( matcher.group(group) ); } return to_a(context, self).aref(idx); // Range }
@JRubyMethod(name = "[]", required = 1) public static IRubyObject aref(final ThreadContext context, final IRubyObject self, final IRubyObject idx) { final java.util.regex.Matcher matcher = unwrapJavaObject(self); if ( idx instanceof RubySymbol || idx instanceof RubyString ) { return context.runtime.newString( matcher.group(idx.toString()) ); } if ( idx instanceof RubyInteger ) { final int group = ((RubyInteger) idx).getIntValue(); return context.runtime.newString( matcher.group(group) ); } return to_a(context, self).aref(idx); // Range }
@Override public IRubyObject call(ThreadContext context, IRubyObject caller, IRubyObject self, IRubyObject arg) { if (self.getMetaClass() == context.runtime.getArray()) { return ((RubyArray) self).aref(arg); } return super.call(context, caller, self, arg); } }
@Override public IRubyObject call(ThreadContext context, IRubyObject caller, IRubyObject self, IRubyObject arg) { if (self.getMetaClass() == context.runtime.getArray()) { return ((RubyArray) self).aref(arg); } return super.call(context, caller, self, arg); } }
@Override public IRubyObject call(ThreadContext context, IRubyObject caller, IRubyObject self, IRubyObject arg) { if (self.getMetaClass() == context.runtime.getArray()) { return ((RubyArray) self).aref(arg); } return super.call(context, caller, self, arg); } }
/** match_aref * */ @JRubyMethod(name = "[]") public IRubyObject op_aref(IRubyObject idx) { check(); IRubyObject result = op_arefCommon(idx); return result == null ? to_a().aref(idx) : result; }
/** match_aref * */ @JRubyMethod(name = "[]") public IRubyObject op_aref(IRubyObject idx, IRubyObject rest) { IRubyObject result; return !rest.isNil() || (result = op_arefCommon(idx)) == null ? to_a().aref(idx, rest) : result; }
/** match_aref * */ @JRubyMethod(name = "[]") public IRubyObject op_aref(IRubyObject idx) { check(); IRubyObject result = op_arefCommon(idx); return result == null ? to_a().aref(idx) : result; }
/** match_aref * */ @JRubyMethod(name = "[]") public IRubyObject op_aref(IRubyObject idx, IRubyObject rest) { IRubyObject result; return !rest.isNil() || (result = op_arefCommon(idx)) == null ? to_a().aref(idx, rest) : result; }
/** match_aref * */ @JRubyMethod(name = "[]") public IRubyObject op_aref(IRubyObject idx, IRubyObject rest) { if (!rest.isNil() || !(idx instanceof RubyFixnum) || ((RubyFixnum)idx).getLongValue() < 0) { return ((RubyArray)to_a()).aref(idx, rest); } return RubyRegexp.nth_match(RubyNumeric.fix2int(idx), this); }
/** match_aref * */ @JRubyMethod(name = "[]") public IRubyObject op_aref(IRubyObject idx, IRubyObject rest) { if (!rest.isNil() || !(idx instanceof RubyFixnum) || ((RubyFixnum)idx).getLongValue() < 0) { return ((RubyArray)to_a()).aref(idx, rest); } return RubyRegexp.nth_match(RubyNumeric.fix2int(idx), this); }
/** match_aref * */ @JRubyMethod(name = "[]") public IRubyObject op_aref(IRubyObject idx) { check(); if (!(idx instanceof RubyFixnum) || ((RubyFixnum)idx).getLongValue() < 0) { return ((RubyArray)to_a()).aref(idx); } return RubyRegexp.nth_match(RubyNumeric.fix2int(idx), this); }
/** match_aref * */ @JRubyMethod(name = "[]") public IRubyObject op_aref(IRubyObject idx) { check(); if (!(idx instanceof RubyFixnum) || ((RubyFixnum)idx).getLongValue() < 0) { return ((RubyArray)to_a()).aref(idx); } return RubyRegexp.nth_match(RubyNumeric.fix2int(idx), this); }
/** rb_ary_indexes * */ @JRubyMethod(name = {"indexes", "indices"}, required = 1, rest = true) public IRubyObject indexes(IRubyObject[] args) { getRuntime().getWarnings().warn(ID.DEPRECATED_METHOD, "Array#indexes is deprecated; use Array#values_at"); RubyArray ary = new RubyArray(getRuntime(), args.length); for (int i = 0; i < args.length; i++) { ary.append(aref(args[i])); } return ary; }
/** rb_ary_indexes * */ @JRubyMethod(name = {"indexes", "indices"}, required = 1, rest = true) public IRubyObject indexes(IRubyObject[] args) { getRuntime().getWarnings().warn(ID.DEPRECATED_METHOD, "Array#indexes is deprecated; use Array#values_at"); RubyArray ary = new RubyArray(getRuntime(), args.length); for (int i = 0; i < args.length; i++) { ary.append(aref(args[i])); } return ary; }