public class RubySymbol extends RubyObject implements MarshalEncoding, EncodingCapable, Constantizable
| Modifier and Type | Class and Description |
|---|---|
static interface |
RubySymbol.ObjBooleanConsumer<T> |
static class |
RubySymbol.SymbolTable |
RubyObject.DataRubyBasicObject.Finalizer| Modifier and Type | Field and Description |
|---|---|
static long |
symbolHashSeedK0
Deprecated.
|
IVAR_INSPECTING_OBJECT_ALLOCATOR, OBJECT_ALLOCATOR, REIFYING_OBJECT_ALLOCATORALL_F, BASICOBJECT_ALLOCATOR, COMPARE_BY_IDENTITY_F, ERR_INSECURE_SET_INST_VAR, FALSE_F, FL_USHIFT, flags, FROZEN_F, IS_OVERLAID_F, metaClass, NEVER, NIL_F, REFINED_MODULE_F, STAMP_OFFSET, TAINTED_F, UNDEF, UNTRUST_F, USER0_F, USER1_F, USER2_F, USER3_F, USER4_F, USER5_F, USER6_F, USER7_F, USER8_F, USER9_F, USERA_F, VAR_TABLE_OFFSET, varTable, varTableStampNULL_ARRAY| Modifier and Type | Method and Description |
|---|---|
static IRubyObject |
all_symbols(IRubyObject recv)
Deprecated.
|
static IRubyObject |
all_symbols(ThreadContext context,
IRubyObject recv) |
RubySymbol |
asInstanceVariable() |
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.
|
RubyString |
asString()
rb_obj_as_string
First converts this object into a String using the "to_s"
method, infects it with the current taint and returns it.
|
RubySymbol |
asWriter()
Make an instance variable out of this symbol (e.g.
|
IRubyObject |
capitalize(ThreadContext context) |
IRubyObject |
capitalize(ThreadContext context,
IRubyObject arg) |
IRubyObject |
capitalize(ThreadContext context,
IRubyObject arg0,
IRubyObject arg1) |
IRubyObject |
casecmp_p(ThreadContext context,
IRubyObject other) |
IRubyObject |
casecmp(ThreadContext context,
IRubyObject other) |
int |
compareTo(IRubyObject that)
Compares this Ruby object with another.
|
java.lang.Object |
constant() |
static RubyClass |
createSymbolClass(Ruby runtime) |
IRubyObject |
downcase(ThreadContext context) |
IRubyObject |
downcase(ThreadContext context,
IRubyObject arg) |
IRubyObject |
downcase(ThreadContext context,
IRubyObject arg0,
IRubyObject arg1) |
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 override does not do a "checked" dispatch.
|
ByteList |
getBytes() |
org.jcodings.Encoding |
getEncoding() |
int |
getId() |
org.jcodings.Encoding |
getMarshalEncoding() |
ClassIndex |
getNativeClassIndex()
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()
This override does not do "checked" dispatch since Object usually has #hash defined.
|
IRubyObject |
id2name() |
IRubyObject |
id2name(ThreadContext context) |
java.lang.String |
idString()
Return an id string (e.g.
|
IRubyObject |
inspect()
rb_obj_inspect
call-seq:
obj.inspect => string
Returns a string containing a human-readable representation of
obj.
|
IRubyObject |
inspect(ThreadContext context) |
IRubyObject |
inspect19(ThreadContext context)
Deprecated.
|
boolean |
isImmediate()
Is object immediate (def: Fixnum, Symbol, true, false, nil?).
|
static int |
javaStringHashCode(ByteList iso8859) |
IRubyObject |
length() |
IRubyObject |
match_m(ThreadContext context,
IRubyObject[] args,
Block block) |
IRubyObject |
match_m(ThreadContext context,
IRubyObject other,
Block block) |
IRubyObject |
match_m(ThreadContext context,
IRubyObject other,
IRubyObject pos,
Block block) |
IRubyObject |
match_p(ThreadContext context,
IRubyObject other) |
IRubyObject |
match_p(ThreadContext context,
IRubyObject other,
IRubyObject pos) |
static RubySymbol |
newConstantSymbol(Ruby runtime,
IRubyObject fqn,
ByteList bytes)
Create a symbol whose intention is to be used as a constant.
|
static RubySymbol |
newHardSymbol(Ruby runtime,
ByteList bytes) |
static RubySymbol |
newHardSymbol(Ruby runtime,
ByteList bytes,
RubySymbol.ObjBooleanConsumer<RubySymbol> handler) |
static RubySymbol |
newHardSymbol(Ruby runtime,
IRubyObject name) |
static RubySymbol |
newHardSymbol(Ruby runtime,
java.lang.String name) |
static RubySymbol |
newHardSymbol(Ruby runtime,
java.lang.String name,
org.jcodings.Encoding encoding) |
static RubySymbol |
newIDSymbol(Ruby runtime,
ByteList bytes)
Generic identifier symbol creation (or retrieval) method.
|
static RubySymbol |
newIDSymbol(Ruby runtime,
ByteList bytes,
RubySymbol.ObjBooleanConsumer<RubySymbol> handler)
Generic identifier symbol creation (or retrieval) method that invokes a handler before storing new symbols.
|
static RubySymbol |
newSymbol(Ruby runtime,
ByteList bytes) |
static RubySymbol |
newSymbol(Ruby runtime,
ByteList bytes,
RubySymbol.ObjBooleanConsumer<RubySymbol> handler)
Return the symbol in the symbol table if it exists, null otherwise.
|
static RubySymbol |
newSymbol(Ruby runtime,
IRubyObject name)
Deprecated.
|
static RubySymbol |
newSymbol(Ruby runtime,
java.lang.String name) |
static RubySymbol |
newSymbol(Ruby runtime,
java.lang.String name,
org.jcodings.Encoding encoding) |
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)
rb_obj_equal
Will by default use identity equality to compare objects.
|
IRubyObject |
op_match(ThreadContext context,
IRubyObject other)
rb_obj_pattern_match
call-seq:
obj =~ other => nil
Pattern Match---Overridden by descendents (notably
Regexp and String) to provide meaningful
pattern-match semantics. |
static RubySymbol |
retrieveIDSymbol(IRubyObject name)
When we know we need an entry in the symbol table because the provided name will be needed to be
accessed as a valid identifier later we can call this.
|
static RubySymbol |
retrieveIDSymbol(IRubyObject name,
RubySymbol.ObjBooleanConsumer<RubySymbol> handler)
Retrieve an ID symbol but call the handler before any new symbol is added to the symbol table.
|
void |
setEncoding(org.jcodings.Encoding e) |
boolean |
shouldMarshalEncoding() |
IRubyObject |
succ(ThreadContext context) |
IRubyObject |
swapcase(ThreadContext context) |
IRubyObject |
swapcase(ThreadContext context,
IRubyObject arg) |
IRubyObject |
swapcase(ThreadContext context,
IRubyObject arg0,
IRubyObject arg1) |
static 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. |
IRubyObject |
to_proc(ThreadContext context) |
IRubyObject |
to_s()
rb_any_to_s
call-seq:
obj.to_s => string
Returns a string representing obj.
|
IRubyObject |
to_s(ThreadContext context) |
IRubyObject |
to_sym() |
IRubyObject |
to_sym19()
Deprecated.
|
<T> T |
toJava(java.lang.Class<T> target)
Convert the object to the specified Java class, if possible.
|
IRubyObject |
toRefinedProc(ThreadContext context,
StaticScope scope) |
java.lang.String |
toString()
Print a string for internal debugging purposes.
|
static RubySymbol |
unmarshalFrom(UnmarshalStream input,
UnmarshalStream.MarshalState state) |
IRubyObject |
upcase(ThreadContext context) |
IRubyObject |
upcase(ThreadContext context,
IRubyObject arg) |
IRubyObject |
upcase(ThreadContext context,
IRubyObject arg0,
IRubyObject arg1) |
boolean |
validClassVariableName()
Is the string this constant represents a valid constant identifier name.
|
boolean |
validConstantName()
Is the string this constant represents a valid constant identifier name.
|
boolean |
validInstanceVariableName()
Is the string this constant represents a valid constant identifier name.
|
boolean |
validLocalVariableName() |
attachToObjectSpace, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, convertToType, createObjectClass, dig, eqlInternal, equalInternal, inspect, puts, specificEval, toRubyStringaddFinalizer, anyToString, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callSuper, checkArrayType, checkCallMethod, checkCallMethod, checkFrozen, checkStringType, checkStringType19, convertToArray, convertToFloat, convertToHash, convertToInteger, convertToInteger, convertToInteger, convertToString, copyInstanceVariablesInto, copySpecialInstanceVariables, createBasicObjectClass, dataGetStruct, dataGetStructChecked, dataWrapStruct, decode, 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, getMetaClass, getNativeHandle, getNativeTypeIndex, getObjectId, getRuntime, getSingletonClassClone, getSingletonClassCloneAndAttach, getType, getVariable, getVariableCount, getVariableList, getVariableNameList, hashyInspect, hasInstanceVariable, hasInternalVariable, hasVariables, id, infectBy, initialize_copy, initialize, 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, isSpecialConst, isSpecialObject, isTaint, isTrue, isUntrusted, kind_of_p, makeMetaClass, method_missing, method_missing19, method, method19, methods, methods, methods19, nil_p, nonFixnumHashCode, OBJ_INIT_COPY, objInitCopy, op_equal_19, op_match19, op_not_equal, op_not_match, op_not, private_methods, private_methods19, protected_methods, protected_methods19, public_methods, public_methods19, rbClone, rbClone, rbInspect, 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_added, singleton_method_added19, singleton_method_removed, singleton_method_removed19, singleton_method_undefined, singleton_method_undefined19, singleton_method, singleton_methods, specificEval, specificEval, specificEval, specificEval, syncVariables, syncVariables, taint, tainted_p, testFrozen, testFrozen, to_a, to_a, trust, type_deprecated, type, untaint, untrust, untrusted_p, validateInstanceVariable, validateInstanceVariable, validateInstanceVariable, variableTableContains, variableTableFastContains, variableTableFastFetch, variableTableFastStore, variableTableFetch, variableTableRemove, variableTableStore, variableTableSync, yieldUnder, yieldUnderclone, finalize, getClass, notify, notifyAll, wait, wait, waitarray@Deprecated public static final long symbolHashSeedK0
public ClassIndex getNativeClassIndex()
RubyObjectgetNativeClassIndex in interface CoreObjectTypegetNativeClassIndex in class RubyObjectClassIndexpublic final java.lang.String asJavaString()
asJavaString in interface IRubyObjectasJavaString in class RubyBasicObjectpublic java.lang.String idString()
public final java.lang.String toString()
toString in class RubyObjectpublic final ByteList getBytes()
public RubySymbol asWriter()
public RubySymbol asInstanceVariable()
public static RubySymbol retrieveIDSymbol(IRubyObject name)
name - to get symbol table entry for (it may be a symbol already)public static RubySymbol retrieveIDSymbol(IRubyObject name, RubySymbol.ObjBooleanConsumer<RubySymbol> handler)
name - to get symbol table entry for (it may be a symbol already)public void associateEncoding(org.jcodings.Encoding encoding)
public final boolean eql(IRubyObject other)
eql in interface IRubyObjecteql in class RubyBasicObjectpublic boolean validConstantName()
public boolean validInstanceVariableName()
public boolean validClassVariableName()
public boolean validLocalVariableName()
public 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)
@Deprecated public static RubySymbol newSymbol(Ruby runtime, IRubyObject name)
public static RubySymbol newHardSymbol(Ruby runtime, IRubyObject name)
public static RubySymbol newSymbol(Ruby runtime, java.lang.String name)
public static RubySymbol newSymbol(Ruby runtime, ByteList bytes)
public static RubySymbol newHardSymbol(Ruby runtime, ByteList bytes)
public static RubySymbol newHardSymbol(Ruby runtime, ByteList bytes, RubySymbol.ObjBooleanConsumer<RubySymbol> handler)
public static RubySymbol newHardSymbol(Ruby runtime, java.lang.String name)
public static RubySymbol newSymbol(Ruby runtime, ByteList bytes, RubySymbol.ObjBooleanConsumer<RubySymbol> handler)
runtime - bytes - public static RubySymbol newIDSymbol(Ruby runtime, ByteList bytes)
runtime - of this Ruby instance.bytes - to be made into a symbol (or to help retreive existing symbol)public static RubySymbol newIDSymbol(Ruby runtime, ByteList bytes, RubySymbol.ObjBooleanConsumer<RubySymbol> handler)
runtime - of this Ruby instance.bytes - to be made into a symbol (or to help retreive existing symbol)public static RubySymbol newConstantSymbol(Ruby runtime, IRubyObject fqn, ByteList bytes)
runtime - of this Ruby instance.fqn - if this constant symbol is part of a broader chain this is used for full name error reporting.bytes - to be made into a symbol (or to help retreive existing symbol)public static RubySymbol newSymbol(Ruby runtime, java.lang.String name, org.jcodings.Encoding encoding)
public static RubySymbol newHardSymbol(Ruby runtime, java.lang.String name, org.jcodings.Encoding encoding)
public java.lang.Object constant()
constant in interface ConstantizableConstantizablepublic 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)
@Deprecated public IRubyObject inspect19(ThreadContext context)
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)
public IRubyObject id2name()
public IRubyObject id2name(ThreadContext context)
public RubyString asString()
RubyBasicObjectRubyBasicObject.anyToString() is used
instead.asString in interface IRubyObjectasString in class RubyBasicObjectpublic IRubyObject op_eqq(ThreadContext context, IRubyObject other)
RubyObjectop_eqq in interface IRubyObjectop_eqq in class RubyObjectpublic IRubyObject op_equal(ThreadContext context, IRubyObject other)
RubyBasicObjectop_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 RubyObjectRubyBasicObject.hashCode()public int getId()
public boolean equals(java.lang.Object other)
RubyObjectequals in class RubyObjectRubyBasicObject.equals(Object)public int compareTo(IRubyObject that)
RubyBasicObjectcompareTo in interface java.lang.Comparable<IRubyObject>compareTo in class RubyBasicObjectthat - another IRubyObjectRubyBasicObject.compareTo(IRubyObject)public IRubyObject to_sym()
@Deprecated 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 RubyBasicObjectpublic 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 casecmp_p(ThreadContext context, IRubyObject other)
public IRubyObject op_match(ThreadContext context, IRubyObject other)
RubyBasicObjectRegexp and String) to provide meaningful
pattern-match semantics.op_match in class RubyBasicObjectpublic IRubyObject match_m(ThreadContext context, IRubyObject other, Block block)
public IRubyObject match_m(ThreadContext context, IRubyObject other, IRubyObject pos, Block block)
public IRubyObject match_m(ThreadContext context, IRubyObject[] args, Block block)
public IRubyObject match_p(ThreadContext context, IRubyObject other)
public IRubyObject match_p(ThreadContext context, IRubyObject other, IRubyObject pos)
public 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 upcase(ThreadContext context, IRubyObject arg)
public IRubyObject upcase(ThreadContext context, IRubyObject arg0, IRubyObject arg1)
public IRubyObject downcase(ThreadContext context)
public IRubyObject downcase(ThreadContext context, IRubyObject arg)
public IRubyObject downcase(ThreadContext context, IRubyObject arg0, IRubyObject arg1)
public IRubyObject swapcase(ThreadContext context)
public IRubyObject swapcase(ThreadContext context, IRubyObject arg)
public IRubyObject swapcase(ThreadContext context, IRubyObject arg0, IRubyObject arg1)
public IRubyObject capitalize(ThreadContext context)
public IRubyObject capitalize(ThreadContext context, IRubyObject arg)
public IRubyObject capitalize(ThreadContext context, IRubyObject arg0, IRubyObject arg1)
public IRubyObject encoding(ThreadContext context)
public IRubyObject to_proc(ThreadContext context)
public IRubyObject toRefinedProc(ThreadContext context, StaticScope scope)
public static IRubyObject all_symbols(ThreadContext context, IRubyObject recv)
@Deprecated public static IRubyObject all_symbols(IRubyObject recv)
public static RubySymbol unmarshalFrom(UnmarshalStream input, UnmarshalStream.MarshalState state) throws java.io.IOException
java.io.IOExceptionpublic <T> T toJava(java.lang.Class<T> target)
IRubyObjecttoJava in interface IRubyObjecttoJava in class RubyBasicObjecttarget - The target type to which the object should be converted.IRubyObject.toJava(java.lang.Class<T>)public static ByteList symbolBytesFromString(Ruby runtime, java.lang.String internedSymbol)
public org.jcodings.Encoding getEncoding()
getEncoding in interface EncodingCapablepublic void setEncoding(org.jcodings.Encoding e)
setEncoding in interface EncodingCapablepublic static int javaStringHashCode(ByteList iso8859)
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 symbolifyCopyright © 2001-2021 JRuby. All Rights Reserved.