Implementation of Ruby String class Concurrency: no synchronization is required among readers, but all users must synchronize externally with writers.
| field | type | note |
|---|---|---|
| NULL_ARRAY | RubyString[] |
atCharBoundary(byte[] bytes, int s, int p, int e, org.jcodings.Encoding enc)bytesToString(byte[] bytes, int beg, int len)bytesToString(byte[] bytes)createStringClass(org.jruby.runtime.ThreadContext context, org.jruby.RubyClass Object, org.jruby.RubyModule Comparable)encodeBytelist(CharSequence value, org.jcodings.Encoding encoding)getEmptyByteList(org.jcodings.Encoding enc)includeRange(org.jruby.runtime.ThreadContext context, org.jruby.RubyString _beg, org.jruby.RubyString _end, org.jruby.runtime.builtin.IRubyObject _val, boolean exclusive)inspect(org.jruby.Ruby runtime, org.jruby.util.ByteList byteList)inspect(org.jruby.runtime.ThreadContext context, org.jruby.util.ByteList byteList)newAllocatedString(org.jruby.Ruby runtime, org.jruby.RubyClass metaClass)newBinaryString(org.jruby.Ruby runtime, String str)newBinaryString(org.jruby.Ruby runtime, org.jruby.util.ByteList str)newChilledString(org.jruby.Ruby runtime, org.jruby.util.ByteList bytes, int coderange, String file, int line)newDebugChilledString(org.jruby.Ruby runtime, org.jruby.RubyClass rubyClass, org.jruby.util.ByteList value, int cr, String file, int line)newDebugFrozenString(org.jruby.Ruby runtime, org.jruby.RubyClass rubyClass, org.jruby.util.ByteList value, int cr, String file, int line)newEmptyBinaryString(org.jruby.Ruby runtime)newEmptyString(org.jruby.Ruby runtime, org.jruby.RubyClass metaClass)newEmptyString(org.jruby.Ruby runtime, org.jruby.RubyClass metaClass, org.jcodings.Encoding enc)newEmptyString(org.jruby.Ruby runtime, org.jcodings.Encoding enc)newExternalStringWithEncoding(org.jruby.Ruby runtime, String string, org.jcodings.Encoding encoding)newFString(org.jruby.Ruby runtime, String content)Create anew or deduplicate a RubyString based on the given Java String content.
| name | type | description |
|---|---|---|
| runtime | org.jruby.Ruby | the JRuby runtime |
| content | String | the Java String content |
Returns: a frozen, deduplicated RubyString hosting the given content
newInstance(org.jruby.runtime.builtin.IRubyObject recv, org.jruby.runtime.builtin.IRubyObject[] args, org.jruby.runtime.Block block)rb_str_s_new
newInternalFromJavaExternal(org.jruby.Ruby runtime, String str)Return a new Ruby String encoded as the default internal encoding given a Java String that has come from an external source. If there is no default internal encoding set, the Ruby String will be encoded using Java's default external encoding. If an internal encoding is set, that encoding will be used for the Ruby String.
newString(org.jruby.Ruby runtime, org.jruby.RubyClass clazz, CharSequence str)newString(org.jruby.Ruby runtime, CharSequence str)newString(org.jruby.Ruby runtime, CharSequence str, org.jcodings.Encoding encoding)newString(org.jruby.Ruby runtime, String str)newString(org.jruby.Ruby runtime, String str, org.jcodings.Encoding encoding)newString(org.jruby.Ruby runtime, byte[] bytes)newString(org.jruby.Ruby runtime, byte[] bytes, int start, int length)newString(org.jruby.Ruby runtime, byte[] bytes, int start, int length, org.jcodings.Encoding encoding)newString(org.jruby.Ruby runtime, org.jruby.util.ByteList bytes)newString(org.jruby.Ruby runtime, org.jruby.util.ByteList bytes, int coderange)newString(org.jruby.Ruby runtime, org.jruby.util.ByteList bytes, org.jcodings.Encoding encoding)newStringLight(org.jruby.Ruby runtime, org.jruby.util.ByteList bytes)newStringLight(org.jruby.Ruby runtime, int size)newStringLight(org.jruby.Ruby runtime, int size, org.jcodings.Encoding encoding)newStringNoCopy(org.jruby.Ruby runtime, byte[] bytes, int start, int length, org.jcodings.Encoding encoding)newStringNoCopy(org.jruby.Ruby runtime, org.jruby.util.ByteList bytes)newStringNoCopy(org.jruby.Ruby runtime, org.jruby.RubyClass clazz, org.jruby.util.ByteList bytes)newStringNoCopy(org.jruby.Ruby runtime, byte[] bytes, int start, int length)newStringNoCopy(org.jruby.Ruby runtime, byte[] bytes)newStringNoCopy(org.jruby.Ruby runtime, org.jruby.RubyClass clazz, org.jruby.util.ByteList bytes, org.jcodings.Encoding enc, int cr)newStringNoCopy(org.jruby.Ruby runtime, org.jruby.util.ByteList bytes, org.jcodings.Encoding enc, int cr)newUnicodeString(org.jruby.Ruby runtime, String str)newUnicodeString(org.jruby.Ruby runtime, CharSequence str)newUsAsciiStringNoCopy(org.jruby.Ruby runtime, org.jruby.util.ByteList bytes)newUSASCIIString(org.jruby.Ruby runtime, String str)newUTF16String(org.jruby.Ruby runtime, String str)newUTF16String(org.jruby.Ruby runtime, CharSequence str)newUTF8String(org.jruby.Ruby runtime, String str)newUTF8String(org.jruby.Ruby runtime, CharSequence str)objAsString(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject obj)rb_obj_as_string
rbStrEscape(org.jruby.runtime.ThreadContext context, org.jruby.RubyString str)stringToBytes(String string)stringValue(org.jruby.runtime.builtin.IRubyObject object)try_convert(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject recv, org.jruby.runtime.builtin.IRubyObject str)unmarshalFrom(org.jruby.runtime.marshal.UnmarshalStream input)unmarshalFrom(org.jruby.runtime.ThreadContext context, org.jruby.util.io.RubyInputStream in, org.jruby.runtime.marshal.MarshalLoader input)append(org.jruby.runtime.builtin.IRubyObject other, java.util.function.Function<org.jruby.runtime.builtin.IRubyObject,org.jruby.RubyString> convert)rb_str_append
append19(org.jruby.runtime.builtin.IRubyObject other)append_as_bytes(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject[] args)append_as_bytes(org.jruby.runtime.ThreadContext context)append_as_bytes(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg0)appendAsDynamicString(org.jruby.runtime.builtin.IRubyObject other)appendAsStringOrAny(org.jruby.runtime.builtin.IRubyObject other)asJavaString()rb_to_id
isAsciiOnly() · also: is_ascii_onlyascii_only_p(org.jruby.runtime.ThreadContext context)associateEncoding(org.jcodings.Encoding enc)isBrokenString() · also: is_broken_stringGet the ByteList which backs this Ruby String
Returns: The byte list
byteindex(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg0)byteindex(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg0, org.jruby.runtime.builtin.IRubyObject arg1)byterindex(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg0)byterindex(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg0, org.jruby.runtime.builtin.IRubyObject arg1)bytes(org.jruby.runtime.ThreadContext context, org.jruby.runtime.Block block)getBytes() · also: get_bytesbytesize(org.jruby.runtime.ThreadContext context)byteslice(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg1, org.jruby.runtime.builtin.IRubyObject arg2)byteslice(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg)bytesplice(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject[] args)bytesplice(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg0, org.jruby.runtime.builtin.IRubyObject arg1)bytesplice(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg0, org.jruby.runtime.builtin.IRubyObject arg1, org.jruby.runtime.builtin.IRubyObject arg2)capacity()Determine how much space exists after the begin offset in this string's buffer.
Returns: the amount of capacity in this string's buffer after the begin offset
capitalize(org.jruby.runtime.ThreadContext context)rb_str_capitalize / rb_str_capitalize_bang
capitalize(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg)capitalize(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg0, org.jruby.runtime.builtin.IRubyObject arg1)capitalize_bang(org.jruby.runtime.ThreadContext context)capitalize_bang(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg)capitalize_bang(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg0, org.jruby.runtime.builtin.IRubyObject arg1)casecmp(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject other)casecmp_p(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject other)cat(org.jruby.util.ByteList other, int codeRange)cat(byte[] bytes, int p, int len, org.jcodings.Encoding enc)cat19(org.jruby.util.ByteList other, int codeRange)catAscii(byte[] bytes, int ptr, int ptrLen)Append a Java String to this RubyString assuming it will be the encoding of the RubyString. If it is not then then it will end up as an invalid string. Some methods assume an encoding of BINARY so that broken bytes are possible/expected (e.g. an error message with two names which are not compatible to be combined into a single Ruby String). Proc#to_s is an example of this.
| name | type | description |
|---|---|---|
| str | String | to be appended |
Returns: this string after it has appended str
catWithCodeRange(org.jruby.RubyString str2)catWithCodeRange(org.jruby.util.ByteList other, int codeRange)center(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg0)rb_str_center
center(org.jruby.runtime.builtin.IRubyObject arg0, org.jruby.runtime.builtin.IRubyObject arg1)center(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg0, org.jruby.runtime.builtin.IRubyObject arg1)charAt(int offset)chars(org.jruby.runtime.ThreadContext context, org.jruby.runtime.Block block)checkEncoding(org.jruby.util.CodeRangeable other)checkFrozen()rb_str_chomp_bang In the common case, removes CR and LF characters in various ways depending on the value of the optional args[0]. If args.length==0 removes one instance of CR, CRLF or LF from the end of the string. If args.length>0 and args[0] is "\n" then same behaviour as args.length==0 . If args.length>0 and args[0] is "" then removes trailing multiple LF or CRLF (but no CRs at all(!)).
chomp(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg0)chomp19(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg0)chomp_bang(org.jruby.runtime.ThreadContext context)chomp_bang(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg0)chomp_bang19(org.jruby.runtime.ThreadContext context)chomp_bang19(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg0)rb_str_chop / rb_str_chop_bang
chop_bang(org.jruby.runtime.ThreadContext context)clearCodeRange()getCodeRange() · also: get_code_rangesetCodeRange(int codeRange) · also: set_code_rangeisCodeRangeAsciiOnly() · also: is_code_range_ascii_onlyisCodeRangeBroken() · also: is_code_range_brokenisCodeRangeValid() · also: is_code_range_validcodepoints(org.jruby.runtime.ThreadContext context, org.jruby.runtime.Block block)concat(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject obj)rb_str_concat
concat(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject[] objs)rb_str_concat_multi
concatSingle(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject other)rb_str_concat
count(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg)count(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject[] args)crypt(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject other)rb_str_crypt
decodeString()Convert this Ruby string to a Java String. This version is encoding-aware.
Returns: A decoded Java String, based on this Ruby string's encoding.
rb_str_delete / rb_str_delete_bang
delete(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg)delete(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject[] args)delete_bang(org.jruby.runtime.ThreadContext context)delete_bang(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg)delete_bang(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject[] args)delete_prefix(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject prefix)delete_prefix_bang(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject prefix)delete_suffix(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject suffix)delete_suffix_bang(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject suffix)downcase(org.jruby.runtime.ThreadContext context)rb_str_downcase / rb_str_downcase_bang
downcase(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg)downcase(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg0, org.jruby.runtime.builtin.IRubyObject arg1)downcase_bang(org.jruby.runtime.ThreadContext context)downcase_bang(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg)downcase_bang(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg0, org.jruby.runtime.builtin.IRubyObject arg1)rb_str_dump
Overridden dup for fast-path logic.
Returns: A new RubyString sharing the original backing store.
dupAsChilled(org.jruby.Ruby runtime, org.jruby.RubyClass clazz, String file, int line)each_byte(org.jruby.runtime.ThreadContext context, org.jruby.runtime.Block block)rb_str_each_byte
each_char(org.jruby.runtime.ThreadContext context, org.jruby.runtime.Block block)each_codepoint(org.jruby.runtime.ThreadContext context, org.jruby.runtime.Block block)rb_str_each_codepoint
each_grapheme_cluster(org.jruby.runtime.ThreadContext context, org.jruby.runtime.Block block)each_line(org.jruby.runtime.ThreadContext context, org.jruby.runtime.Block block)rb_str_each_line
each_line(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg, org.jruby.runtime.Block block)each_line(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg, org.jruby.runtime.builtin.IRubyObject opts, org.jruby.runtime.Block block)each_lineCommon(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject sep, org.jruby.runtime.Block block)empty()isEmpty() · also: is_emptyempty_p(org.jruby.runtime.ThreadContext context)rb_str_empty
encStrScrub(org.jruby.runtime.ThreadContext context, org.jcodings.Encoding enc, org.jruby.runtime.builtin.IRubyObject repl, org.jruby.runtime.Block block)encStrScrub(org.jruby.runtime.ThreadContext context, org.jcodings.Encoding enc, org.jruby.runtime.builtin.IRubyObject repl, int cr, org.jruby.runtime.Block block)encode(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg)encode(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject toEncoding, org.jruby.runtime.builtin.IRubyObject arg)encode(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject toEncoding, org.jruby.runtime.builtin.IRubyObject forcedEncoding, org.jruby.runtime.builtin.IRubyObject opts)encode_bang(org.jruby.runtime.ThreadContext context)encode_bang(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg0)encode_bang(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg0, org.jruby.runtime.builtin.IRubyObject arg1)encode_bang(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg0, org.jruby.runtime.builtin.IRubyObject arg1, org.jruby.runtime.builtin.IRubyObject arg2)encode_bang(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject[] args)getEncoding() · also: get_encodingencoding(org.jruby.runtime.ThreadContext context)setEncoding(org.jcodings.Encoding encoding) · also: set_encodingend_with_p(org.jruby.runtime.ThreadContext context)end_with_p(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg)end_with_p(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject[] args)endsWithAsciiChar(char c)ensureAvailable(org.jruby.runtime.ThreadContext context, int extraLength)Ensure the backing store belongs to this string and has enough space to add extraLength bytes. MRI: str_ensure_available_capa
| name | type | description |
|---|---|---|
| context | org.jruby.runtime.ThreadContext | the current thread context |
| extra_length | int | the extra length needed |
ensureInstanceVariablesSettable()short circuit for String key comparison
equals(Object other)force_encoding(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject enc)getbyte(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject index)grapheme_clusters(org.jruby.runtime.ThreadContext context, org.jruby.runtime.Block block)gsub(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg0, org.jruby.runtime.Block block)gsub(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg0, org.jruby.runtime.builtin.IRubyObject arg1, org.jruby.runtime.Block block)gsub_bang(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg0, org.jruby.runtime.Block block)gsub_bang(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg0, org.jruby.runtime.builtin.IRubyObject arg1, org.jruby.runtime.Block block)gsubFast(org.jruby.runtime.ThreadContext context, org.jruby.RubyRegexp regexp, org.jruby.RubyString repl, org.jruby.runtime.Block block)hasNul() · also: has_nulDoes this string contain \0 anywhere (per byte search).
Returns: true if it does
hashCode()rb_str_hex
include_p(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject obj)rb_str_include
independent()index(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg0)rb_str_index_m
index(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg0, org.jruby.runtime.builtin.IRubyObject arg1)initialize(org.jruby.runtime.ThreadContext context)initialize(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg0)initialize(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg0, org.jruby.runtime.builtin.IRubyObject opts)initialize_copy(org.jruby.runtime.builtin.IRubyObject other)initialize_copy(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject other)insert(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject indexArg, org.jruby.runtime.builtin.IRubyObject arg)inspect(org.jruby.runtime.ThreadContext context)rb_str_inspect
Is this a "bare" string, i.e. has no instance vars, and class == String.
getJavaClass() · also: get_java_classkeepCodeRange()length()lines(org.jruby.runtime.ThreadContext context, org.jruby.runtime.Block block)lines(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg, org.jruby.runtime.Block block)lines(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg, org.jruby.runtime.builtin.IRubyObject opts, org.jruby.runtime.Block block)ljust(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg0)rb_str_ljust
ljust(org.jruby.runtime.builtin.IRubyObject arg0, org.jruby.runtime.builtin.IRubyObject arg1)ljust(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg0, org.jruby.runtime.builtin.IRubyObject arg1)rb_str_lstrip / rb_str_lstrip_bang
lstrip_bang(org.jruby.runtime.ThreadContext context)getMarshalEncoding() · also: get_marshal_encodingmatch(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject pattern)String#match(pattern) rb_str_match_m
| name | type | description |
|---|---|---|
| pattern | org.jruby.runtime.builtin.IRubyObject | Regexp or String |
match(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject pattern, org.jruby.runtime.Block block)match(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject pattern, org.jruby.runtime.builtin.IRubyObject pos, org.jruby.runtime.Block block)match(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject[] args, org.jruby.runtime.Block block)match19(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject pattern)match19(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject pattern, org.jruby.runtime.builtin.IRubyObject pos, org.jruby.runtime.Block block)match19(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject[] args, org.jruby.runtime.Block block)match_p(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject pattern)match_p(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject pattern, org.jruby.runtime.builtin.IRubyObject pos)minus_at(org.jruby.runtime.ThreadContext context)modify()modify(int length)rb_str_modify (with length bytes ensured)
modify19()modifyAndClearCodeRange()modifyAndKeepCodeRange()modifyCheck()Check that the string can be modified, raising error otherwise. If you plan to modify a string with shared backing store, this method is not sufficient; you will need to call modify() instead.
modifyCheck(byte[] b, int len)modifyExpand(int length)rb_str_modify_expand
rb_str_oct
op_aref(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg)rb_str_aref, rb_str_aref_m
op_aref(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg1, org.jruby.runtime.builtin.IRubyObject arg2)op_aset(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg0, org.jruby.runtime.builtin.IRubyObject arg1)rb_str_aset, rb_str_aset_m
op_aset(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg0, org.jruby.runtime.builtin.IRubyObject arg1, org.jruby.runtime.builtin.IRubyObject arg2)op_cmp(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject other)op_equal(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject other)rb_str_equal
op_format(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg)op_ge(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject other)op_ge19(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject other)op_gt(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject other)op_gt19(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject other)op_le(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject other)op_le19(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject other)op_lt(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject other)op_lt19(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject other)op_match(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject other)rb_str_match
op_mul(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject other)op_mul19(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject other)op_plus(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg)op_plus19(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg)partition(org.jruby.runtime.ThreadContext context, org.jruby.runtime.Block block)partition(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg, org.jruby.runtime.Block block)plus_at(org.jruby.runtime.ThreadContext context)prepend(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject other)rb_str_prepend
prepend(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject[] objs)rb_str_prepend
rbStrOffset(int pos)setReadLength(int length) · also: set_read_lengthreplace(org.jruby.runtime.builtin.IRubyObject other)replace(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject other)rb_str_replace_m
replace19(org.jruby.runtime.builtin.IRubyObject other)resize(int size)rb_str_resize
reverse(org.jruby.runtime.ThreadContext context)reverse19(org.jruby.runtime.ThreadContext context)reverse_bang(org.jruby.runtime.ThreadContext context)reverse_bang19(org.jruby.runtime.ThreadContext context)rindex(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg0)rb_str_rindex_m
rindex(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg0, org.jruby.runtime.builtin.IRubyObject arg1)rjust(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg0)rb_str_rjust
rjust(org.jruby.runtime.builtin.IRubyObject arg0, org.jruby.runtime.builtin.IRubyObject arg1)rjust(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg0, org.jruby.runtime.builtin.IRubyObject arg1)rpartition(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg)rb_str_rstrip / rb_str_rstrip_bang
rstrip_bang(org.jruby.runtime.ThreadContext context)rubyLength(org.jruby.runtime.ThreadContext context)scan(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject pat, org.jruby.runtime.Block block)rb_str_scan
scanForCodeRange()scrub(org.jruby.runtime.ThreadContext context, org.jruby.runtime.Block block)scrub(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject repl, org.jruby.runtime.Block block)scrub_bang(org.jruby.runtime.ThreadContext context, org.jruby.runtime.Block block)scrub_bang(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject repl, org.jruby.runtime.Block block)setEncodingAndCodeRange(org.jcodings.Encoding enc, int cr)setbyte(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject index, org.jruby.runtime.builtin.IRubyObject val)shouldMarshalEncoding()singletonClass(org.jruby.runtime.ThreadContext context)size()slice_bang(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg0)rb_str_slice_bang
slice_bang(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg0, org.jruby.runtime.builtin.IRubyObject arg1)split(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg0)split(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject pattern, org.jruby.runtime.builtin.IRubyObject limit)Split for ext (Java) callers (does not write $~).
Returns: splited entries
split(org.jruby.RubyRegexp delimiter, int limit)split(org.jruby.runtime.ThreadContext context, org.jruby.RubyRegexp delimiter, int limit)Split for ext (Java) callers (does not write $~).
| name | type | description |
|---|---|---|
| context | org.jruby.runtime.ThreadContext | the thread context |
Returns: splited entries
split(org.jruby.RubyString delimiter, int limit)split(org.jruby.runtime.ThreadContext context, org.jruby.RubyString delimiter, int limit)Split for ext (Java) callers (does not write $~).
| name | type | description |
|---|---|---|
| context | org.jruby.runtime.ThreadContext | the thread context |
Returns: splited entries
splitWithBlock(org.jruby.runtime.ThreadContext context, org.jruby.runtime.Block block)rb_str_split_m
splitWithBlock(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg0, org.jruby.runtime.Block block)splitWithBlock(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject pattern, org.jruby.runtime.builtin.IRubyObject limit, org.jruby.runtime.Block block)squeeze(org.jruby.runtime.ThreadContext context)rb_str_squeeze / rb_str_squeeze_bang
squeeze(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg)squeeze(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject[] args)squeeze_bang(org.jruby.runtime.ThreadContext context)squeeze_bang(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg)squeeze_bang(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject[] args)start_with_p(org.jruby.runtime.ThreadContext context)start_with_p(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg)start_with_p(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject[] args)strDup(org.jruby.Ruby runtime, org.jruby.RubyClass clazz)str_eql_p(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject other)str_eql_p19(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject other)Generate a hash for the String, using its associated Ruby instance's hash seed.
| name | type | description |
|---|---|---|
| runtime | org.jruby.Ruby | the runtime |
Returns: calculated hash
strLength()strScrub(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject repl, org.jruby.runtime.Block block)Scrub the contents of this string, replacing invalid characters as appropriate. MRI: rb_str_scrub
stringToInum(int base, boolean badcheck)rb_str_to_inum
rb_str_strip / rb_str_strip_bang
strip_bang(org.jruby.runtime.ThreadContext context)sub(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg0, org.jruby.runtime.Block block)rb_str_sub / rb_str_sub_bang
sub(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg0, org.jruby.runtime.builtin.IRubyObject arg1, org.jruby.runtime.Block block)sub_bang(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg0, org.jruby.runtime.Block block)sub_bang(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg0, org.jruby.runtime.builtin.IRubyObject arg1, org.jruby.runtime.Block block)subBangFast(org.jruby.runtime.ThreadContext context, org.jruby.RubyRegexp regexp, org.jruby.RubyString repl)sub! but without any frame globals ...
| name | type | description |
|---|---|---|
| context | org.jruby.runtime.ThreadContext | current context |
| regexp | org.jruby.RubyRegexp | the regular expression |
| repl | org.jruby.RubyString | replacement string value |
Returns: sub result
subSequence(int start, int end)substr(org.jruby.Ruby runtime, int beg, int len)substr(org.jruby.runtime.ThreadContext context, int beg, int len)substr19(org.jruby.Ruby runtime, int beg, int len)substrEnc(org.jruby.Ruby runtime, int beg, int len)substrEnc(org.jruby.runtime.ThreadContext context, int beg, int len)succ_bang(org.jruby.runtime.ThreadContext context)sum(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg)sumCommon(org.jruby.runtime.ThreadContext context, long bits)swapcase(org.jruby.runtime.ThreadContext context)rb_str_swapcase / rb_str_swapcase_bang
swapcase(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg)swapcase(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg0, org.jruby.runtime.builtin.IRubyObject arg1)swapcase_bang(org.jruby.runtime.ThreadContext context)swapcase_bang(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg)swapcase_bang(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg0, org.jruby.runtime.builtin.IRubyObject arg1)string_to_c
to_i(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg0)rb_str_to_i
toJava(Class<T> target)string_to_r
toString()tr(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject src, org.jruby.runtime.builtin.IRubyObject repl)rb_str_tr / rb_str_tr_bang
tr19(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject src, org.jruby.runtime.builtin.IRubyObject repl)tr_bang(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject src, org.jruby.runtime.builtin.IRubyObject repl)tr_bang19(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject src, org.jruby.runtime.builtin.IRubyObject repl)tr_s(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject src, org.jruby.runtime.builtin.IRubyObject repl)rb_str_tr_s / rb_str_tr_s_bang
tr_s19(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject src, org.jruby.runtime.builtin.IRubyObject repl)tr_s_bang(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject src, org.jruby.runtime.builtin.IRubyObject repl)tr_s_bang19(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject src, org.jruby.runtime.builtin.IRubyObject repl)getUnicodeValue() · also: get_unicode_valueused by ar-jdbc
unpack(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject obj, org.jruby.runtime.Block block)unpack(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject obj, org.jruby.runtime.builtin.IRubyObject opt, org.jruby.runtime.Block block)unpack1(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject obj, org.jruby.runtime.Block block)unpack1(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject obj, org.jruby.runtime.builtin.IRubyObject opt, org.jruby.runtime.Block block)Generate a hash for the String, without a seed.
| name | type | description |
|---|---|---|
| runtime | org.jruby.Ruby | the runtime |
Returns: calculated hash
rb_str_upcase / rb_str_upcase_bang
upcase(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg)upcase(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg0, org.jruby.runtime.builtin.IRubyObject arg1)upcase_bang(org.jruby.runtime.ThreadContext context)upcase_bang(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg)upcase_bang(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg0, org.jruby.runtime.builtin.IRubyObject arg1)upto(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject end, org.jruby.runtime.Block block)rb_str_upto_m
upto(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject end, org.jruby.runtime.builtin.IRubyObject excl, org.jruby.runtime.Block block)valid_encoding_p(org.jruby.runtime.ThreadContext context)getValue() · also: get_valuesetValue(CharSequence value) · also: set_valueverifyAsciiCompatible()#checkStringType() instead.
is this a string?
Returns: the string if so
marshalLiveVariables(org.jruby.runtime.marshal.MarshalDumper stream, org.jruby.runtime.ThreadContext context, org.jruby.util.io.RubyOutputStream out)chars()codePoints()getChars(int arg0, int arg1, char[] arg2, int arg3)| field | type | note |
|---|---|---|
| ALL_F | int | |
| BASICOBJECT_ALLOCATOR | ObjectAllocator | Default allocator instance for all Ruby objects. The only reason to not use this allocator is if you actually need to have all instances of something be a subclass of RubyObject. |
| COMPARE_BY_IDENTITY_F | int | |
| ERR_INSECURE_SET_INST_VAR | String | The error message used when some one tries to modify an instance variable in a high security setting. |
| FALSE_F | int | |
| FL_USHIFT | int | |
| FROZEN_F | int | |
| IS_OVERLAID_F | int | |
| NEVER | IRubyObject | A value that is used as a null sentinel in among other places the RubyArray implementation. It will cause large problems to call any methods on this object. |
| NIL_F | int | This flag is a bit funny. It's used to denote that this value
is nil. It's a bit counterintuitive for a Java programmer to
not use subclassing to handle this case, since we have a
RubyNil subclass anyway. Well, the reason for it being a flag
is that the #isNil() method is called extremely often. So often
that it gives a good speed boost to make it monomorphic and
final. It turns out using a flag for this actually gives us
better performance than having a polymorphic #isNil() method. |
| REFINED_MODULE_F | int | |
| STAMP_OFFSET | long | |
| TAINTED_F | int | |
| UNDEF | IRubyObject | A value that specifies an undefined value. This value is used as a sentinel for undefined constant values, and other places where neither null nor NEVER makes sense. |
| USER0_F | int | |
| USER1_F | int | |
| USER2_F | int | |
| USER3_F | int | |
| USER4_F | int | |
| USER5_F | int | |
| USER6_F | int | |
| USER7_F | int | |
| USER8_F | int | |
| USER9_F | int | |
| USERA_F | int | |
| VAR_TABLE_OFFSET | long | |
| varTable | Object[] | variable table, lazily allocated as needed (if needed) |
| varTableStamp | int | locking stamp for Unsafe ops updating the vartable |
rb_obj_id Return the internal id of an object.
addFinalizer(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject f)Adds the specified object as a finalizer for this object.
Internal method that helps to convert any object into the format of a class name and a hex string inside of #<>.
callMethod(org.jruby.runtime.ThreadContext context, String name)Will invoke a named method with no arguments and no block.
callMethod(org.jruby.runtime.ThreadContext context, String name, org.jruby.runtime.builtin.IRubyObject arg)Will invoke a named method with one argument and no block with functional invocation.
callMethod(org.jruby.runtime.ThreadContext context, String name, org.jruby.runtime.builtin.IRubyObject[] args)Will invoke a named method with the supplied arguments and no block with functional invocation.
callMethod(String name, org.jruby.runtime.builtin.IRubyObject[] args)callMethod(String name, org.jruby.runtime.builtin.IRubyObject arg)callMethod(org.jruby.runtime.ThreadContext context, String name, org.jruby.runtime.builtin.IRubyObject[] args, org.jruby.runtime.Block block)Will invoke a named method with the supplied arguments and supplied block with functional invocation.
callMethod(org.jruby.runtime.ThreadContext context, int methodIndex, String name)callMethod(org.jruby.runtime.ThreadContext context, int methodIndex, String name, org.jruby.runtime.builtin.IRubyObject arg)callSuper(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject[] args, org.jruby.runtime.Block block)rb_check_array_type Returns the result of trying to convert this object to an Array with "to_ary".
checkCallMethod(org.jruby.runtime.ThreadContext context, String name)Will invoke a named method with no arguments and no block if that method or a custom method missing exists. Otherwise returns null. 1.9: rb_check_funcall
checkCallMethod(org.jruby.runtime.ThreadContext context, org.jruby.runtime.JavaSites.CheckedSites sites)Will invoke a named method with no arguments and no block if that method or a custom method missing exists. Otherwise returns null. 1.9: rb_check_funcall
isClass() · also: is_classSpecifically polymorphic method that are meant to be overridden by classes to specify that they are classes in an easy way.
Tries to convert this object to a Ruby Array using the "to_ary" method.
Returns: array representation of this
Tries to convert this object to a Ruby Float using the "to_f" method.
Returns: float representation of this
Tries to convert this object to a Ruby Hash using the "to_hash" method.
Returns: hash representation of this
Tries to convert this object to a Ruby Integer using the "to_int" method.
Returns: an integer representation of this
convertToInteger(String convertMethod)Tries to convert this object to a Ruby Integer using the supplied conversion method.
| name | type | description |
|---|---|---|
| convert_method | String | conversion method to use e.g. "to_i" |
Returns: an integer representation of this
convertToInteger(int methodIndex, String convertMethod)copyInstanceVariablesInto(org.jruby.runtime.builtin.InstanceVariables other)copySpecialInstanceVariables(org.jruby.runtime.builtin.IRubyObject clone)Lots of MRI objects keep their state in non-lookupable ivars (e:g. Range, Struct, etc). This method is responsible for dupping our java field equivalents
dataGetStruct()dataGetStructChecked()dataWrapStruct(Object obj)raw (id) strings are not properly encoded but in an iso_8859_1 form. This method will lookup properly encoded string from the symbol table.
| name | type | description |
|---|---|---|
| id | String | the id of the string |
Returns: the string of the symbol found from id
display(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject[] args)eql_p(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject obj)equal_p(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject other)rb_obj_equal Will use Java identity equality.
| name | type | description |
|---|---|---|
| context | org.jruby.runtime.ThreadContext | the thread context |
| other | org.jruby.runtime.builtin.IRubyObject | to compare with |
Returns: are they equal?
evalUnder(org.jruby.runtime.ThreadContext context, org.jruby.RubyModule under, org.jruby.RubyString src, String file, int line, org.jruby.EvalType evalType)extend(org.jruby.runtime.builtin.IRubyObject[] args)rb_obj_extend call-seq: obj.extend(module, ...) => obj Adds to _obj_ the instance methods from each module given as a parameter. module Mod def hello "Hello from Mod.\n" end end class Klass def hello "Hello from Klass.\n" end end k = Klass.new k.hello #=> "Hello from Klass.\n" k.extend(Mod) #=> #<Klass:0x401b3bc8> k.hello #=> "Hello from Mod.\n"
| name | type | description |
|---|---|---|
| args | org.jruby.runtime.builtin.IRubyObject[] | to use as modules to extend |
Returns: itself
isFalse() · also: is_falseIs this value a falsey value or not? Based on the #FALSE_F flag.
Returns: true is false
fastGetInstanceVariable(String internedName)fastGetInternalVariable(String internedName)fastHasInstanceVariable(String internedName)fastHasInternalVariable(String internedName)fastSetInstanceVariable(String internedName, org.jruby.runtime.builtin.IRubyObject value)fastSetInternalVariable(String internedName, Object value)getFFIHandle() · also: get_ffi_handlesetFFIHandle(Object value) · also: set_ffi_handleforEachInstanceVariable(java.util.function.BiConsumer<String,org.jruby.runtime.builtin.IRubyObject> accessor)forEachInstanceVariableName(java.util.function.Consumer<String> consumer)setFrozen(boolean frozen) · also: set_frozenSets whether this object is frozen or not. Shortcut for doing setFlag(FROZEN_F, frozen).
| name | type | description |
|---|---|---|
| frozen | boolean | should this object be frozen? |
isFrozen() · also: is_frozenIs this value frozen or not? Shortcut for doing getFlag(FROZEN_F).
Returns: true if this object is frozen, false otherwise
frozen_p(org.jruby.runtime.ThreadContext context)getFlag(int flag)Get the value of a custom flag on this object. The only guaranteed flags that can be sent in to this method is:
#FALSE_F#NIL_F#FROZEN_F| name | type | description |
|---|---|---|
| flag | int | the flag to get |
Returns: true if the flag is set, false otherwise
getInternalVariable(String name)getVariable(int index)hasInstanceVariable(String name)hasInternalVariable(String name)hasVariables() · also: has_variablesReturns true if object has any variables
RubyBasicObject#hash(ThreadContext) instead.
Will return the hash code of this object. In comparison to MRI, this method will use the Java identity hash code instead of using rb_obj_id, since the usage of id in JRuby will incur the cost of some. ObjectSpace maintenance.
Returns: hash value
isImmediate() · also: is_immediateIs object immediate (def: Fixnum, Symbol, true, false, nil?).
instance_eval(org.jruby.runtime.ThreadContext context, org.jruby.runtime.Block block)instance_eval(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg0, org.jruby.runtime.Block block)instance_eval(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg0, org.jruby.runtime.builtin.IRubyObject arg1, org.jruby.runtime.Block block)instance_eval(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg0, org.jruby.runtime.builtin.IRubyObject arg1, org.jruby.runtime.builtin.IRubyObject arg2, org.jruby.runtime.Block block)instance_eval(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject[] args, org.jruby.runtime.Block block)instance_exec(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject[] args, org.jruby.runtime.Block block)rb_obj_instance_exec call-seq: obj.instance_exec(arg...) {|var...| block } => obj Executes the given block within the context of the receiver (_obj_). In order to set the context, the variable +self+ is set to _obj_ while the code is executing, giving the code access to _obj_'s instance variables. Arguments are passed as block parameters. class Klass def initialize @secret = 99 end end k = Klass.new k.instance_exec(5) {|x| @secret+x } #=> 104
| name | type | description |
|---|---|---|
| context | org.jruby.runtime.ThreadContext | the thread context |
| args | org.jruby.runtime.builtin.IRubyObject[] | the args |
| block | org.jruby.runtime.Block | block |
Returns: the result
instance_of_p(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject type)rb_obj_is_instance_of
call-seq:
obj.instance_of?(class) => true or false
Returns true if obj is an instance of the given
class. See also Object#kind_of?.
| name | type | description |
|---|---|---|
| context | org.jruby.runtime.ThreadContext | the thread context |
| type | org.jruby.runtime.builtin.IRubyObject | the type |
Returns: true if this is instance of type
instance_variable_defined_p(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject name)rb_obj_ivar_defined
call-seq:
obj.instance_variable_defined?(symbol) => true or false
Returns true if the given instance variable is
defined in obj.
class Fred
def initialize(p1, p2)
@a, @b = p1, p2
end
end
fred = Fred.new('cat', 99)
fred.instance_variable_defined?(:@a) #=> true
fred.instance_variable_defined?("@b") #=> true
fred.instance_variable_defined?("@c") #=> false
| name | type | description |
|---|---|---|
| context | org.jruby.runtime.ThreadContext | the thread context |
| name | org.jruby.runtime.builtin.IRubyObject | of ivar |
Returns: true if defined
instance_variable_get(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject name)rb_obj_ivar_get
call-seq:
obj.instance_variable_get(symbol) => obj
Returns the value of the given instance variable, or nil if the
instance variable is not set. The @ part of the
variable name should be included for regular instance
variables. Throws a NameError exception if the
supplied symbol is not valid as an instance variable name.
class Fred
def initialize(p1, p2)
@a, @b = p1, p2
end
end
fred = Fred.new('cat', 99)
fred.instance_variable_get(:@a) #=> "cat"
fred.instance_variable_get("@b") #=> 99
| name | type | description |
|---|---|---|
| context | org.jruby.runtime.ThreadContext | the thread context |
| name | org.jruby.runtime.builtin.IRubyObject | of ivar |
Returns: value of ivar
getInstanceVariableList() · also: get_instance_variable_listGets a list of all variables in this object.
getInstanceVariableNameList() · also: get_instance_variable_name_listGets a name list of all variables in this object.
instance_variable_set(org.jruby.runtime.builtin.IRubyObject name, org.jruby.runtime.builtin.IRubyObject value)rb_obj_ivar_set call-seq: obj.instance_variable_set(symbol, obj) => obj Sets the instance variable names by symbol to object, thereby frustrating the efforts of the class's author to attempt to provide proper encapsulation. The variable did not have to exist prior to this call. class Fred def initialize(p1, p2) @a, @b = p1, p2 end end fred = Fred.new('cat', 99) fred.instance_variable_set(:@a, 'dog') #=> "dog" fred.instance_variable_set(:@c, 'cat') #=> "cat" fred.inspect #=> "#<Fred:0x401b3da8 @a=\"dog\", @b=99, @c=\"cat\">"
| name | type | description |
|---|---|---|
| name | org.jruby.runtime.builtin.IRubyObject | of ivar |
| value | org.jruby.runtime.builtin.IRubyObject | to set |
Returns: value of old set ivar
getInstanceVariables() · also: get_instance_variablesDummy method to avoid a cast, and to avoid polluting the IRubyObject interface with all the instance variable management methods.
instance_variables(org.jruby.runtime.ThreadContext context)rb_obj_instance_variables call-seq: obj.instance_variables => array Returns an array of instance variable names for the receiver. Note that simply defining an accessor does not create the corresponding instance variable. class Fred attr_accessor :a1 def initialize @iv = 3 end end Fred.new.instance_variables #=> [:"@iv"]
| name | type | description |
|---|---|---|
| context | org.jruby.runtime.ThreadContext | the thread context |
Returns: list of ivars
getInternalVariables() · also: get_internal_variablesDummy method to avoid a cast, and to avoid polluting the IRubyObject interface with all the instance variable management methods.
isBuiltin(String methodName)A method to determine whether the method named by methodName is a builtin method, i.e. a method built-in to JRuby and loaded during its core boot process.
| name | type | description |
|---|---|---|
| method_name | String | to look for. |
Returns: true if so
kind_of_p(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject type)rb_obj_is_kind_of
call-seq:
obj.is_a?(class) => true or false
obj.kind_of?(class) => true or false
Returns true if class is the class of
obj, or if class is one of the superclasses of
obj or modules included in obj.
module M; end
class A
include M
end
class B < A; end
class C < B; end
b = B.new
b.instance_of? A #=> false
b.instance_of? B #=> true
b.instance_of? C #=> false
b.instance_of? M #=> false
b.kind_of? A #=> true
b.kind_of? B #=> true
b.kind_of? C #=> false
b.kind_of? M #=> true
| name | type | description |
|---|---|---|
| context | org.jruby.runtime.ThreadContext | the thread context |
| type | org.jruby.runtime.builtin.IRubyObject | the type |
Returns: true if this is kind of type
makeMetaClass(org.jruby.runtime.ThreadContext context, org.jruby.RubyClass superClass)rb_make_metaclass Will create a new meta class, insert this in the chain of classes for this specific object, and return the generated meta class.
| name | type | description |
|---|---|---|
| context | org.jruby.runtime.ThreadContext | the thread context |
| super_class | org.jruby.RubyClass | the super class |
Returns: the new meta class
makeMetaClassBootstrap(org.jruby.Ruby runtime, org.jruby.RubyClass superClass, org.jruby.RubyClass Class)This will create a new metaclass. This is only used during bootstrapping before
the initial ThreadContext is defined. Normal needs of making a metaclass should use
RubyBasicObject#makeMetaClass(ThreadContext, RubyClass)
| name | type | description |
|---|---|---|
| runtime | org.jruby.Ruby | the runtime |
| super_class | org.jruby.RubyClass | of the metaclass |
| class | org.jruby.RubyClass | a reference to Ruby Class |
Returns: the new metaclass
getMarshalVariableList() · also: get_marshal_variable_listif exist return the meta-class else return the type of the object.
setMetaClass(org.jruby.RubyClass metaClass) · also: set_meta_classMakes it possible to change the metaclass of an object. In practice, this is a simple version of Smalltalks Become, except that it doesn't work when we're dealing with subclasses. In practice it's used to change the singleton/meta class used, without changing the "real" inheritance chain.
| name | type | description |
|---|---|---|
| meta_class | org.jruby.RubyClass | the meta class to set |
method(org.jruby.runtime.builtin.IRubyObject name, org.jruby.parser.StaticScope refinedScope)method(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject name, org.jruby.parser.StaticScope refinedScope)Like #method(IRubyObject) but using the given refinement scope to search for the method.
| name | type | description |
|---|---|---|
| context | org.jruby.runtime.ThreadContext | the thread context |
| name | org.jruby.runtime.builtin.IRubyObject | the name of the method |
| refined_scope | org.jruby.parser.StaticScope | the static scope for the caller method |
Returns: method instance
methods(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject[] args)rb_obj_methods call-seq: obj.methods => array Returns a list of the names of methods publicly accessible in obj. This will include all the methods accessible in obj's ancestors. class Klass def kMethod() end end k = Klass.new k.methods[0..9] #=> ["kMethod", "freeze", "nil?", "is_a?", "class", "instance_variable_set", "methods", "extend", "__send__", "instance_eval"] k.methods.length #=> 42
| name | type | description |
|---|---|---|
| context | org.jruby.runtime.ThreadContext | the thread context |
| args | org.jruby.runtime.builtin.IRubyObject[] | include ancestors |
Returns: methods
methods(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject[] args, boolean useSymbols)isModule() · also: is_moduleSpecifically polymorphic method that are meant to be overridden by modules to specify that they are modules in an easy way.
getNativeHandle() · also: get_native_handlesetNativeHandle(Object value) · also: set_native_handlegetNativeTypeIndex() · also: get_native_type_indexisNil() · also: is_nilDoes this object represent nil? See the docs for the #NIL_F flag for more information.
rb_false
call_seq:
nil.nil? => true
<anything_else>.nil? => false
Only the object nil responds true to nil?.
| name | type | description |
|---|---|---|
| context | org.jruby.runtime.ThreadContext | the thread context |
Returns: true if nil
op_not_equal(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject other)The != method implemented for BasicObject.
| name | type | description |
|---|---|---|
| context | org.jruby.runtime.ThreadContext | thread context |
| other | org.jruby.runtime.builtin.IRubyObject | other object |
Returns: false if this == other, true otherwise
op_not_match(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg)Invert the match operator.
| name | type | description |
|---|---|---|
| context | org.jruby.runtime.ThreadContext | the thread context |
| arg | org.jruby.runtime.builtin.IRubyObject | arg |
Returns: true if they do not match
private_methods(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject[] args)protected_methods(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject[] args)public_methods(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject[] args)rbClone(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject maybeOpts)removeFinalizers()Remove all the finalizers for this object.
remove_instance_variable(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject name, org.jruby.runtime.Block block)rb_obj_remove_instance_variable call-seq: obj.remove_instance_variable(symbol) => obj Removes the named instance variable from obj, returning that variable's value. class Dummy attr_reader :var def initialize @var = 99 end def remove remove_instance_variable(:@var) end end d = Dummy.new d.var #=> 99 d.remove #=> 99 d.var #=> nil
| name | type | description |
|---|---|---|
| context | org.jruby.runtime.ThreadContext | the thread context |
| name | org.jruby.runtime.builtin.IRubyObject | of ivar |
| block | org.jruby.runtime.Block | the block (not used) |
Returns: value of removed ivar
removeInternalVariable(String name)respond_to_p(org.jruby.runtime.builtin.IRubyObject mname)respond_to_p(org.jruby.runtime.builtin.IRubyObject mname, org.jruby.runtime.builtin.IRubyObject includePrivate)respondsTo(String name)Does this object respond to the specified message? Uses a shortcut if it can be proved that respond_to? and respond_to_missing? haven't been overridden.
respondsToMissing(String name)Does this object respond to the specified message via "method_missing?"
respondsToMissing(String name, boolean incPrivate)Does this object respond to the specified message via "method_missing?"
Will return the runtime that this object is associated with.
Returns: current runtime
send(org.jruby.runtime.ThreadContext context, org.jruby.runtime.Block block)send(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg0, org.jruby.runtime.Block block)send(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg0, org.jruby.runtime.builtin.IRubyObject arg1, org.jruby.runtime.Block block)send(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg0, org.jruby.runtime.builtin.IRubyObject arg1, org.jruby.runtime.builtin.IRubyObject arg2, org.jruby.runtime.Block block)send(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject[] args, org.jruby.runtime.Block block)setFlag(int flag, boolean set)Sets or unsets a flag on this object. The only flags that are guaranteed to be valid to use as the first argument is:
#FALSE_F#NIL_F#FROZEN_F| name | type | description |
|---|---|---|
| flag | int | the actual flag to set or unset. |
| set | boolean | if true, the flag will be set, if false, the flag will be unset. |
setInstanceVariable(String name, org.jruby.runtime.builtin.IRubyObject value)rb_iv_set / rb_ivar_set
setInternalVariable(String name, Object value)setVariable(int index, Object value)singleton_method(org.jruby.runtime.builtin.IRubyObject name)singleton_method(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject name)singleton_methods(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject[] args)isSpecialConst() · also: is_special_constisSpecialObject() · also: is_special_objectspecificEval(org.jruby.runtime.ThreadContext context, org.jruby.RubyModule mod, org.jruby.runtime.Block block, org.jruby.EvalType evalType)specific_eval Evaluates the block or string inside of the context of this object, using the supplied arguments. If a block is given, this will be yielded in the specific context of this object. If no block is given then a String-like object needs to be the first argument, and this string will be evaluated. Second and third arguments in the args-array is optional, but can contain the filename and line of the string under evaluation.
| name | type | description |
|---|---|---|
| context | org.jruby.runtime.ThreadContext | the thread context |
| mod | org.jruby.RubyModule | module to yield in |
| block | org.jruby.runtime.Block | to call |
| eval_type | org.jruby.EvalType | type of evaal to perform |
Returns: the result
specificEval(org.jruby.runtime.ThreadContext context, org.jruby.RubyModule mod, org.jruby.runtime.builtin.IRubyObject arg, org.jruby.runtime.Block block, org.jruby.EvalType evalType)specific_eval Evaluates the block or string inside of the context of this object, using the supplied arguments. If a block is given, this will be yielded in the specific context of this object. If no block is given then a String-like object needs to be the first argument, and this string will be evaluated. Second and third arguments in the args-array is optional, but can contain the filename and line of the string under evaluation.
| name | type | description |
|---|---|---|
| context | org.jruby.runtime.ThreadContext | the thread context |
| mod | org.jruby.RubyModule | module to yield in |
| arg | org.jruby.runtime.builtin.IRubyObject | to pass to block |
| block | org.jruby.runtime.Block | to call |
| eval_type | org.jruby.EvalType | type of evaal to perform |
Returns: the result
specificEval(org.jruby.runtime.ThreadContext context, org.jruby.RubyModule mod, org.jruby.runtime.builtin.IRubyObject arg0, org.jruby.runtime.builtin.IRubyObject arg1, org.jruby.runtime.Block block, org.jruby.EvalType evalType)specific_eval Evaluates the block or string inside of the context of this object, using the supplied arguments. If a block is given, this will be yielded in the specific context of this object. If no block is given then a String-like object needs to be the first argument, and this string will be evaluated. Second and third arguments in the args-array is optional, but can contain the filename and line of the string under evaluation.
| name | type | description |
|---|---|---|
| context | org.jruby.runtime.ThreadContext | the thread context |
| mod | org.jruby.RubyModule | module to yield in |
| arg0 | org.jruby.runtime.builtin.IRubyObject | to pass to block |
| arg1 | org.jruby.runtime.builtin.IRubyObject | to pass to block |
| block | org.jruby.runtime.Block | to call |
| eval_type | org.jruby.EvalType | type of evaal to perform |
Returns: the result
specificEval(org.jruby.runtime.ThreadContext context, org.jruby.RubyModule mod, org.jruby.runtime.builtin.IRubyObject arg0, org.jruby.runtime.builtin.IRubyObject arg1, org.jruby.runtime.builtin.IRubyObject arg2, org.jruby.runtime.Block block, org.jruby.EvalType evalType)specific_eval Evaluates the block or string inside of the context of this object, using the supplied arguments. If a block is given, this will be yielded in the specific context of this object. If no block is given then a String-like object needs to be the first argument, and this string will be evaluated. Second and third arguments in the args-array is optional, but can contain the filename and line of the string under evaluation.
| name | type | description |
|---|---|---|
| context | org.jruby.runtime.ThreadContext | the thread context |
| mod | org.jruby.RubyModule | module to yield in |
| arg0 | org.jruby.runtime.builtin.IRubyObject | to pass to block |
| arg1 | org.jruby.runtime.builtin.IRubyObject | to pass to block |
| arg2 | org.jruby.runtime.builtin.IRubyObject | to pass to block |
| block | org.jruby.runtime.Block | to call |
| eval_type | org.jruby.EvalType | type of evaal to perform |
Returns: the result
syncVariables(org.jruby.runtime.builtin.IRubyObject other)Sync one this object's variables with other's - this is used to make rbClone work correctly.
syncVariables(List<org.jruby.runtime.builtin.Variable<Object>> variables)setTaint(boolean taint) · also: set_taintisTaint() · also: is_tainttainted_p(org.jruby.runtime.ThreadContext context)RubyBasicObject#to_s(ThreadContext) instead.
Returns: ""
isTrue() · also: is_trueIs this value a truthy value or not? Based on the #FALSE_F flag.
Returns: true it truthy
rb_obj_class Returns the real class of this object, excluding any singleton/meta class in the inheritance chain.
Returns: the real class
untaint(org.jruby.runtime.ThreadContext context)untrust(org.jruby.runtime.ThreadContext context)setUntrusted(boolean untrusted) · also: set_untrustedisUntrusted() · also: is_untrusteduntrusted_p(org.jruby.runtime.ThreadContext context)getVariableCount() · also: get_variable_countGets a list of all variables in this object.
getVariableNameList() · also: get_variable_name_listGets a name list of all variables in this object.
| field | type | note |
|---|---|---|
| IVAR_INSPECTING_OBJECT_ALLOCATOR | ObjectAllocator | Allocator that inspects all methods for instance variables and chooses a concrete class to construct based on that. This allows using specialized subclasses to hold instance variables in fields rather than always holding them in an array. |
| OBJECT_ALLOCATOR | ObjectAllocator | Default allocator instance for all Ruby objects. The only reason to not use this allocator is if you actually need to have all instances of something be a subclass of RubyObject. |
| REIFYING_OBJECT_ALLOCATOR | ObjectAllocator |
attachToObjectSpace()Will make sure that this object is added to the current object space.
callInit(org.jruby.runtime.builtin.IRubyObject[] args, org.jruby.runtime.Block block)Call the Ruby initialize method with the supplied arguments and block.
| name | type | description |
|---|---|---|
| args | org.jruby.runtime.builtin.IRubyObject[] | args |
| block | org.jruby.runtime.Block | block |
Call the Ruby initialize method with the supplied arguments and block.
| name | type | description |
|---|---|---|
| block | org.jruby.runtime.Block | block |
callInit(org.jruby.runtime.builtin.IRubyObject arg0, org.jruby.runtime.Block block)Call the Ruby initialize method with the supplied arguments and block.
| name | type | description |
|---|---|---|
| arg0 | org.jruby.runtime.builtin.IRubyObject | arg0 |
| block | org.jruby.runtime.Block | block |
callInit(org.jruby.runtime.builtin.IRubyObject arg0, org.jruby.runtime.builtin.IRubyObject arg1, org.jruby.runtime.Block block)Call the Ruby initialize method with the supplied arguments and block.
| name | type | description |
|---|---|---|
| arg0 | org.jruby.runtime.builtin.IRubyObject | arg0 |
| arg1 | org.jruby.runtime.builtin.IRubyObject | arg1 |
| block | org.jruby.runtime.Block | block |
callInit(org.jruby.runtime.builtin.IRubyObject arg0, org.jruby.runtime.builtin.IRubyObject arg1, org.jruby.runtime.builtin.IRubyObject arg2, org.jruby.runtime.Block block)callInit(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject[] args, org.jruby.runtime.Block block)callInit(org.jruby.runtime.ThreadContext context, org.jruby.runtime.Block block)callInit(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg0, org.jruby.runtime.Block block)callInit(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg0, org.jruby.runtime.builtin.IRubyObject arg1, org.jruby.runtime.Block block)callInit(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg0, org.jruby.runtime.builtin.IRubyObject arg1, org.jruby.runtime.builtin.IRubyObject arg2, org.jruby.runtime.Block block)convertToType(org.jruby.RubyClass target, int convertMethodIndex)op_eqq(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject other)rb_equal The Ruby "===" method is used by default in case/when statements. The Object implementation first checks Java identity equality and then calls the "==" method too.
specificEval(org.jruby.runtime.ThreadContext context, org.jruby.RubyModule mod, org.jruby.runtime.builtin.IRubyObject[] args, org.jruby.runtime.Block block, org.jruby.EvalType evalType)toRubyString(org.jruby.runtime.ThreadContext context)The default toString method is just a wrapper that calls the Ruby "to_s" method. This will raise if it is not actually a Ruby String.
| name | type | description |
|---|---|---|
| context | org.jruby.runtime.ThreadContext | thread context this is executing on. |
Returns: the string.