public class RubySymbol extends RubyObject implements MarshalEncoding
| Modifier and Type | Class and Description |
|---|---|
static class |
RubySymbol.SymbolTable |
RubyObject.DataRubyBasicObject.Finalizer| Modifier and Type | Field and Description |
|---|---|
private int |
hashCode |
private int |
id |
private java.lang.String |
symbol |
private org.jruby.util.ByteList |
symbolBytes |
static long |
symbolHashSeedK0 |
FIELD_ALLOCATED_CLASSES, FIELD_ALLOCATORS, IVAR_INSPECTING_OBJECT_ALLOCATOR, OBJECT_ALLOCATOR, OBJECT_VAR0_ALLOCATOR, OBJECT_VAR1_ALLOCATOR, OBJECT_VAR2_ALLOCATOR, OBJECT_VAR3_ALLOCATOR, OBJECT_VAR4_ALLOCATOR, OBJECT_VAR5_ALLOCATOR, OBJECT_VAR6_ALLOCATOR, OBJECT_VAR7_ALLOCATOR, OBJECT_VAR8_ALLOCATOR, OBJECT_VAR9_ALLOCATOR, REIFYING_OBJECT_ALLOCATORALL_F, BASICOBJECT_ALLOCATOR, COMPARE_BY_IDENTITY_F, ERR_INSECURE_SET_INST_VAR, FALSE_F, FL_USHIFT, flags, FROZEN_F, metaClass, NEVER, NIL_F, STAMP_OFFSET, TAINTED_F, UNDEF, UNTRUSTED_F, USER0_F, USER1_F, USER2_F, USER3_F, USER4_F, USER5_F, USER6_F, USER7_F, USER8_F, VAR_TABLE_OFFSET, varTable, varTableStampNULL_ARRAY| Modifier | Constructor and Description |
|---|---|
private |
RubySymbol(Ruby runtime,
java.lang.String internedSymbol) |
private |
RubySymbol(Ruby runtime,
java.lang.String internedSymbol,
org.jruby.util.ByteList symbolBytes) |
| Modifier and Type | Method and Description |
|---|---|
static IRubyObject |
all_symbols(IRubyObject recv)
Deprecated.
|
static IRubyObject |
all_symbols(ThreadContext context,
IRubyObject recv) |
java.lang.String |
asJavaString()
rb_to_id
|
void |
associateEncoding(org.jcodings.Encoding encoding)
RubySymbol is created by passing in a String and bytes are extracted from that.
|
IRubyObject |
capitalize(ThreadContext context) |
IRubyObject |
casecmp(ThreadContext context,
IRubyObject other) |
int |
compareTo(IRubyObject that)
Compares this Ruby object with another.
|
static RubyClass |
createSymbolClass(Ruby runtime) |
IRubyObject |
downcase(ThreadContext context) |
IRubyObject |
empty_p(ThreadContext context) |
IRubyObject |
encoding(ThreadContext context) |
boolean |
eql(IRubyObject other)
short circuit for Symbol key comparison
|
boolean |
equals(java.lang.Object other)
This method is just a wrapper around the Ruby "==" method,
provided so that RubyObjects can be used as keys in the Java
HashMap object underlying RubyHash.
|
(package private) org.jruby.util.ByteList |
getBytes() |
int |
getId() |
org.jcodings.Encoding |
getMarshalEncoding() |
int |
getNativeTypeIndex()
This is overridden in the other concrete Java builtins to provide a fast way
to determine what type they are.
|
RubyClass |
getSingletonClass()
rb_singleton_class
Note: this method is specialized for RubyFixnum, RubySymbol,
RubyNil and RubyBoolean
Will either return the existing singleton class for this
object, or create a new one and return that.
|
static RubySymbol |
getSymbolLong(Ruby runtime,
long id) |
RubyFixnum |
hash()
Deprecated.
|
RubyFixnum |
hash(ThreadContext context) |
int |
hashCode()
Override the Object#hashCode method to make sure that the Ruby
hash is actually used as the hashcode for Ruby objects.
|
IRubyObject |
id2name() |
IRubyObject |
id2name(ThreadContext context) |
IRubyObject |
inspect()
Deprecated.
|
private IRubyObject |
inspect(Ruby runtime) |
IRubyObject |
inspect(ThreadContext context) |
IRubyObject |
inspect19()
Deprecated.
|
private IRubyObject |
inspect19(Ruby runtime) |
IRubyObject |
inspect19(ThreadContext context) |
private static boolean |
isIdentChar(char c) |
private static boolean |
isIdentifier(java.lang.String s) |
private static boolean |
isIdentStart(char c) |
boolean |
isImmediate()
Is object immediate (def: Fixnum, Symbol, true, false, nil?).
|
private boolean |
isPrintable() |
private static boolean |
isSpecialGlobalName(java.lang.String s)
is_special_global_name from parse.c.
|
private static boolean |
isSymbolLocal(java.lang.String s,
char c,
int length) |
private static boolean |
isSymbolName(java.lang.String s) |
private static boolean |
isSymbolName19(java.lang.String s) |
private static boolean |
isSymbolNameCommon(java.lang.String s,
char c,
int length) |
IRubyObject |
length() |
private RubyString |
newShared(Ruby runtime) |
static RubySymbol |
newSymbol(Ruby runtime,
IRubyObject name) |
static RubySymbol |
newSymbol(Ruby runtime,
java.lang.String name) |
static java.lang.String |
objectToSymbolString(IRubyObject object)
Properly stringify an object for the current "raw bytes" representation
of a symbol.
|
IRubyObject |
op_aref(ThreadContext context,
IRubyObject arg) |
IRubyObject |
op_aref(ThreadContext context,
IRubyObject arg1,
IRubyObject arg2) |
IRubyObject |
op_cmp(ThreadContext context,
IRubyObject other) |
IRubyObject |
op_eqq(ThreadContext context,
IRubyObject other)
rb_equal
The Ruby "===" method is used by default in case/when
statements.
|
IRubyObject |
op_equal(ThreadContext context,
IRubyObject other) |
IRubyObject |
op_match19(ThreadContext context,
IRubyObject other) |
private RubyString |
rubyStringFromString(Ruby runtime) |
boolean |
shouldMarshalEncoding() |
IRubyObject |
succ(ThreadContext context) |
IRubyObject |
swapcase(ThreadContext context) |
private static org.jruby.util.ByteList |
symbolBytesFromString(Ruby runtime,
java.lang.String internedSymbol) |
IRubyObject |
taint(ThreadContext context)
rb_obj_taint
call-seq:
obj.taint -> obj
Marks obj as tainted---if the
$SAFE level is
set appropriately, many method calls which might alter the running
programs environment will refuse to accept tainted strings. |
RubyFixnum |
to_i()
Deprecated.
|
private RubyFixnum |
to_i(Ruby runtime) |
RubyFixnum |
to_i(ThreadContext context) |
RubyFixnum |
to_int()
Deprecated.
|
private RubyFixnum |
to_int(Ruby runtime) |
RubyFixnum |
to_int(ThreadContext context) |
IRubyObject |
to_proc(ThreadContext context) |
IRubyObject |
to_s()
rb_any_to_s
call-seq:
obj.to_s => string
Returns a string representing obj.
|
private IRubyObject |
to_s(Ruby runtime) |
IRubyObject |
to_s(ThreadContext context) |
IRubyObject |
to_sym() |
IRubyObject |
to_sym19() |
java.lang.Object |
toJava(java.lang.Class target)
Convert the object to the specified Java class, if possible.
|
java.lang.String |
toString()
The default toString method is just a wrapper that calls the
Ruby "to_s" method.
|
static RubySymbol |
unmarshalFrom(UnmarshalStream input) |
IRubyObject |
upcase(ThreadContext context) |
attachToObjectSpace, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, convertToType, createObjectClass, eqlInternal, equalInternal, initialize, initialize, inspect, puts, specificEvaladdFinalizer, anyToString, asString, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callSuper, checkArrayType, checkCallMethod, checkFrozen, checkStringType, checkStringType19, convertToArray, convertToFloat, convertToHash, convertToInteger, convertToInteger, convertToInteger, convertToString, copyInstanceVariablesInto, copySpecialInstanceVariables, createBasicObjectClass, dataGetStruct, dataGetStructChecked, dataWrapStruct, display, dup, ensureInstanceVariablesSettable, eql_p, equal_p, equal_p19, evalUnder, extend, fastGetInstanceVariable, fastGetInternalVariable, fastHasInstanceVariable, fastHasInternalVariable, fastSetInstanceVariable, fastSetInternalVariable, freeze, frozen_p, getFFIHandle, getFlag, getInstanceEvalClass, getInstanceVariable, getInstanceVariableList, getInstanceVariableNameList, getInstanceVariables, getInternalVariable, getInternalVariables, getJavaClass, getMetaClass, getNativeHandle, getObjectId, getRuntime, getSingletonClassClone, getType, getVariable, getVariableCount, getVariableList, getVariableNameList, hashyInspect, hasInstanceVariable, hasInternalVariable, hasVariables, id_deprecated, id, infectBy, infectBy, infectBy, initialize_copy, initialize19, inspectHashCode, instance_eval, instance_eval, instance_eval, instance_eval, instance_eval19, instance_eval19, instance_eval19, instance_eval19, instance_exec, instance_exec19, instance_of_p, instance_variable_defined_p, instance_variable_get, instance_variable_set, instance_variables, instance_variables19, isBuiltin, isClass, isFalse, isFrozen, isModule, isNil, isTaint, isTrue, isUntrusted, kind_of_p, makeMetaClass, method_missing19, method, method19, methods, methods, methods19, nil_p, op_equal_19, op_match, op_not_equal, op_not_match, op_not, private_methods, private_methods19, protected_methods, protected_methods19, public_methods, public_methods19, rbClone, recacheBuiltinMethods, remove_instance_variable, removeFinalizers, removeInstanceVariable, removeInternalVariable, respond_to_p, respond_to_p, respond_to_p19, respond_to_p19, respondsTo, respondsToMissing, respondsToMissing, send, send, send, send, send, send19, send19, send19, send19, setFFIHandle, setFlag, setFrozen, setInstanceVariable, setInternalVariable, setMetaClass, setNativeHandle, setTaint, setUntrusted, setVariable, singleton_method_added19, singleton_method_removed19, singleton_method_undefined19, singleton_methods, singleton_methods19, specificEval, specificEval, specificEval, specificEval, syncVariables, syncVariables, taint, tainted_p, testFrozen, testFrozen, to_a, trust, type_deprecated, type, untaint, untrust, untrusted_p, validateInstanceVariable, variableTableContains, variableTableFastContains, variableTableFastFetch, variableTableFastStore, variableTableFetch, variableTableRemove, variableTableStore, variableTableSync, yieldUnder, yieldUnderpublic static final long symbolHashSeedK0
private final java.lang.String symbol
private final int id
private final org.jruby.util.ByteList symbolBytes
private final int hashCode
private RubySymbol(Ruby runtime, java.lang.String internedSymbol, org.jruby.util.ByteList symbolBytes)
runtime - internedSymbol - the String value of the new Symbol. This must
have been previously internedprivate RubySymbol(Ruby runtime, java.lang.String internedSymbol)
public int getNativeTypeIndex()
RubyObjectgetNativeTypeIndex in interface CoreObjectTypegetNativeTypeIndex in class RubyObjectClassIndexpublic java.lang.String asJavaString()
asJavaString in interface IRubyObjectasJavaString in class RubyBasicObjectpublic java.lang.String toString()
RubyObjecttoString in class RubyObjectfinal org.jruby.util.ByteList getBytes()
public void associateEncoding(org.jcodings.Encoding encoding)
public final boolean eql(IRubyObject other)
eql in interface IRubyObjecteql in class RubyBasicObjectpublic boolean isImmediate()
RubyBasicObjectisImmediate in interface IRubyObjectisImmediate in class RubyBasicObjectpublic RubyClass getSingletonClass()
RubyBasicObjectgetSingletonClass in interface IRubyObjectgetSingletonClass in class RubyBasicObjectpublic static RubySymbol getSymbolLong(Ruby runtime, long id)
public static RubySymbol newSymbol(Ruby runtime, IRubyObject name)
public static RubySymbol newSymbol(Ruby runtime, java.lang.String name)
@Deprecated public RubyFixnum to_i()
public RubyFixnum to_i(ThreadContext context)
private final RubyFixnum to_i(Ruby runtime)
@Deprecated public RubyFixnum to_int()
public RubyFixnum to_int(ThreadContext context)
private final RubyFixnum to_int(Ruby runtime)
@Deprecated public IRubyObject inspect()
RubyBasicObjectto_s method to
generate the string.
[ 1, 2, 3..4, 'five' ].inspect #=> "[1, 2, 3..4, \"five\"]"
Time.new.inspect #=> "Wed Apr 09 08:54:39 CDT 2003"inspect in interface IRubyObjectinspect in class RubyBasicObjectpublic IRubyObject inspect(ThreadContext context)
private final IRubyObject inspect(Ruby runtime)
@Deprecated public IRubyObject inspect19()
public IRubyObject inspect19(ThreadContext context)
private final IRubyObject inspect19(Ruby runtime)
public IRubyObject to_s()
RubyBasicObjectto_s prints the object's class and an encoding of the
object id. As a special case, the top-level object that is the
initial execution context of Ruby programs returns ``main.''to_s in class RubyBasicObjectpublic IRubyObject to_s(ThreadContext context)
private final IRubyObject to_s(Ruby runtime)
public IRubyObject id2name()
public IRubyObject id2name(ThreadContext context)
public IRubyObject op_eqq(ThreadContext context, IRubyObject other)
RubyObjectop_eqq in interface IRubyObjectop_eqq in class RubyObjectpublic IRubyObject op_equal(ThreadContext context, IRubyObject other)
op_equal in interface IRubyObjectop_equal in class RubyBasicObject@Deprecated public RubyFixnum hash()
RubyBasicObjecthash in class RubyBasicObjectpublic RubyFixnum hash(ThreadContext context)
public int hashCode()
RubyObjecthashCode in class RubyObjectpublic int getId()
public boolean equals(java.lang.Object other)
RubyObjectequals in class RubyObjectpublic int compareTo(IRubyObject that)
RubyBasicObjectcompareTo in interface java.lang.Comparable<IRubyObject>compareTo in class RubyBasicObjectthat - another IRubyObjectRubyBasicObject.compareTo(IRubyObject)public IRubyObject to_sym()
public IRubyObject to_sym19()
public IRubyObject taint(ThreadContext context)
RubyBasicObject$SAFE level is
set appropriately, many method calls which might alter the running
programs environment will refuse to accept tainted strings.taint in class RubyBasicObjectprivate RubyString newShared(Ruby runtime)
private RubyString rubyStringFromString(Ruby runtime)
public IRubyObject succ(ThreadContext context)
public IRubyObject op_cmp(ThreadContext context, IRubyObject other)
op_cmp in class RubyBasicObjectpublic IRubyObject casecmp(ThreadContext context, IRubyObject other)
public IRubyObject op_match19(ThreadContext context, IRubyObject other)
op_match19 in class RubyBasicObjectpublic IRubyObject op_aref(ThreadContext context, IRubyObject arg)
public IRubyObject op_aref(ThreadContext context, IRubyObject arg1, IRubyObject arg2)
public IRubyObject length()
public IRubyObject empty_p(ThreadContext context)
public IRubyObject upcase(ThreadContext context)
public IRubyObject downcase(ThreadContext context)
public IRubyObject capitalize(ThreadContext context)
public IRubyObject swapcase(ThreadContext context)
public IRubyObject encoding(ThreadContext context)
public IRubyObject to_proc(ThreadContext context)
private static boolean isIdentStart(char c)
private static boolean isIdentChar(char c)
private static boolean isIdentifier(java.lang.String s)
private static boolean isSpecialGlobalName(java.lang.String s)
s - private boolean isPrintable()
private static boolean isSymbolName19(java.lang.String s)
private static boolean isSymbolName(java.lang.String s)
private static boolean isSymbolNameCommon(java.lang.String s,
char c,
int length)
private static boolean isSymbolLocal(java.lang.String s,
char c,
int length)
public static IRubyObject all_symbols(ThreadContext context, IRubyObject recv)
@Deprecated public static IRubyObject all_symbols(IRubyObject recv)
public static RubySymbol unmarshalFrom(UnmarshalStream input) throws java.io.IOException
java.io.IOExceptionpublic java.lang.Object toJava(java.lang.Class target)
IRubyObjecttoJava in interface IRubyObjecttoJava in class RubyBasicObjecttarget - The target type to which the object should be converted.IRubyObject.toJava(java.lang.Class)private static org.jruby.util.ByteList symbolBytesFromString(Ruby runtime, java.lang.String internedSymbol)
public boolean shouldMarshalEncoding()
shouldMarshalEncoding in interface MarshalEncodingpublic org.jcodings.Encoding getMarshalEncoding()
getMarshalEncoding in interface MarshalEncodingpublic static java.lang.String objectToSymbolString(IRubyObject object)
object - the object to symbolify