@Deprecated public final IRubyObject substr(int beg, int len) { return substr(getRuntime(), beg, len); }
@Deprecated public final IRubyObject substr(int beg, int len) { return substr(getRuntime(), beg, len); }
@Deprecated public final IRubyObject substr(int beg, int len) { return substr(getRuntime(), beg, len); }
@Deprecated public final IRubyObject substr(int beg, int len) { return substr(getRuntime(), beg, len); }
@JRubyMethod // str[ 0..start(0) ] public static IRubyObject pre_match(final ThreadContext context, final IRubyObject self) { final java.util.regex.Matcher matcher = unwrapJavaObject(self); return str(context, self).substr(context.runtime, 0, matcher.start(0)); }
@JRubyMethod // str[ 0..start(0) ] public static IRubyObject pre_match(final ThreadContext context, final IRubyObject self) { final java.util.regex.Matcher matcher = unwrapJavaObject(self); return str(context, self).substr(context.runtime, 0, matcher.start(0)); }
private IRubyObject inspect1() { final Ruby runtime = getRuntime(); if (pos == 0) return RubyString.newEmptyString(runtime); if (pos > INSPECT_LENGTH) { return RubyString.newStringNoCopy(runtime, DOT_BYTES). append(str.substr(runtime, pos - INSPECT_LENGTH, INSPECT_LENGTH)).inspect(); } return str.substr(runtime, 0, pos).inspect(); }
@JRubyMethod // str[ end(0)..-1 ] public static IRubyObject post_match(final ThreadContext context, final IRubyObject self) { final java.util.regex.Matcher matcher = unwrapJavaObject(self); final RubyString str = str(context, self); final int offset = matcher.end(0); return str.substr(context.runtime, offset, str.size() - offset); }
@JRubyMethod // str[ end(0)..-1 ] public static IRubyObject post_match(final ThreadContext context, final IRubyObject self) { final java.util.regex.Matcher matcher = unwrapJavaObject(self); final RubyString str = str(context, self); final int offset = matcher.end(0); return str.substr(context.runtime, offset, str.size() - offset); }
private IRubyObject inspect1() { final Ruby runtime = getRuntime(); if (pos == 0) return RubyString.newEmptyString(runtime); if (pos > INSPECT_LENGTH) { return RubyString.newStringNoCopy(runtime, DOT_BYTES). append(str.substr(runtime, pos - INSPECT_LENGTH, INSPECT_LENGTH)).inspect(); } return str.substr(runtime, 0, pos).inspect(); }
private IRubyObject inspect1() { if (pos == 0) return RubyString.newEmptyString(getRuntime()); if (pos > INSPECT_LENGTH) { return RubyString.newStringNoCopy(getRuntime(), "...".getBytes()). append(str.substr(getRuntime(), pos - INSPECT_LENGTH, INSPECT_LENGTH)).inspect(); } else { return str.substr(getRuntime(), 0, pos).inspect(); } }
private IRubyObject inspect1() { if (pos == 0) return RubyString.newEmptyString(getRuntime()); if (pos > INSPECT_LENGTH) { return RubyString.newStringNoCopy(getRuntime(), "...".getBytes()). append(str.substr(getRuntime(), pos - INSPECT_LENGTH, INSPECT_LENGTH)).inspect(); } else { return str.substr(getRuntime(), 0, pos).inspect(); } }
private IRubyObject inspect2() { final Ruby runtime = getRuntime(); if (pos >= str.getByteList().getRealSize()) return RubyString.newEmptyString(runtime); int len = str.getByteList().getRealSize() - pos; if (len > INSPECT_LENGTH) { return ((RubyString) str.substr(runtime, pos, INSPECT_LENGTH)).cat(DOT_BYTES).inspect(); } return str.substr(runtime, pos, len).inspect(); }
private IRubyObject inspect2() { final Ruby runtime = getRuntime(); if (pos >= str.getByteList().getRealSize()) return RubyString.newEmptyString(runtime); int len = str.getByteList().getRealSize() - pos; if (len > INSPECT_LENGTH) { return ((RubyString) str.substr(runtime, pos, INSPECT_LENGTH)).cat(DOT_BYTES).inspect(); } return str.substr(runtime, pos, len).inspect(); }
private IRubyObject inspect2() { if (pos >= str.getByteList().getRealSize()) return RubyString.newEmptyString(getRuntime()); int len = str.getByteList().getRealSize() - pos; if (len > INSPECT_LENGTH) { return ((RubyString)str.substr(getRuntime(), pos, INSPECT_LENGTH)).cat("...".getBytes()).inspect(); } else { return str.substr(getRuntime(), pos, len).inspect(); } }
private IRubyObject inspect2() { if (pos >= str.getByteList().getRealSize()) return RubyString.newEmptyString(getRuntime()); int len = str.getByteList().getRealSize() - pos; if (len > INSPECT_LENGTH) { return ((RubyString)str.substr(getRuntime(), pos, INSPECT_LENGTH)).cat("...".getBytes()).inspect(); } else { return str.substr(getRuntime(), pos, len).inspect(); } }
/** rb_str_aref, rb_str_aref_m * */ @JRubyMethod(name = {"[]", "slice"}, reads = BACKREF, writes = BACKREF, compat = RUBY1_8) public IRubyObject op_aref(ThreadContext context, IRubyObject arg1, IRubyObject arg2) { Ruby runtime = context.runtime; if (arg1 instanceof RubyRegexp) return subpat(runtime, context, (RubyRegexp)arg1, RubyNumeric.num2int(arg2)); return substr(runtime, RubyNumeric.num2int(arg1), RubyNumeric.num2int(arg2)); }
/** rb_str_aref, rb_str_aref_m * */ @JRubyMethod(name = {"[]", "slice"}, reads = BACKREF, writes = BACKREF, compat = RUBY1_8) public IRubyObject op_aref(ThreadContext context, IRubyObject arg1, IRubyObject arg2) { Ruby runtime = context.runtime; if (arg1 instanceof RubyRegexp) return subpat(runtime, context, (RubyRegexp)arg1, RubyNumeric.num2int(arg2)); return substr(runtime, RubyNumeric.num2int(arg1), RubyNumeric.num2int(arg2)); }
@JRubyMethod(required = 1) public IRubyObject putc(ThreadContext context, IRubyObject ch) { IRubyObject str; if (ch instanceof RubyString) { str = ((RubyString) ch).substr(context.runtime, 0, 1); } else { str = RubyString.newStringShared(context.runtime, RubyInteger.singleCharByteList(RubyNumeric.num2chr(ch))); } sites(context).write.call(context, this, this, str); return ch; }
@JRubyMethod(required = 1) public IRubyObject putc(ThreadContext context, IRubyObject ch) { IRubyObject str; if (ch instanceof RubyString) { str = ((RubyString) ch).substr(context.runtime, 0, 1); } else { str = RubyString.newStringShared(context.runtime, RubyInteger.singleCharByteList(RubyNumeric.num2chr(ch))); } sites(context).write.call(context, this, this, str); return ch; }