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.Data
RubyBasicObject.Finalizer
Modifier and Type | Field and Description |
---|---|
static long |
symbolHashSeedK0
Deprecated.
|
IVAR_INSPECTING_OBJECT_ALLOCATOR, OBJECT_ALLOCATOR, REIFYING_OBJECT_ALLOCATOR
ALL_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, varTableStamp
NULL_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, toRubyString
addFinalizer, 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, trust, type_deprecated, type, untaint, untrust, untrusted_p, validateInstanceVariable, validateInstanceVariable, validateInstanceVariable, variableTableContains, variableTableFastContains, variableTableFastFetch, variableTableFastStore, variableTableFetch, variableTableRemove, variableTableStore, variableTableSync, yieldUnder, yieldUnder
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
array
@Deprecated public static final long symbolHashSeedK0
public ClassIndex getNativeClassIndex()
RubyObject
getNativeClassIndex
in interface CoreObjectType
getNativeClassIndex
in class RubyObject
ClassIndex
public final java.lang.String asJavaString()
asJavaString
in interface IRubyObject
asJavaString
in class RubyBasicObject
public java.lang.String idString()
public final java.lang.String toString()
toString
in class RubyObject
public 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 IRubyObject
eql
in class RubyBasicObject
public boolean validConstantName()
public boolean validInstanceVariableName()
public boolean validClassVariableName()
public boolean validLocalVariableName()
public boolean isImmediate()
RubyBasicObject
isImmediate
in interface IRubyObject
isImmediate
in class RubyBasicObject
public RubyClass getSingletonClass()
RubyBasicObject
getSingletonClass
in interface IRubyObject
getSingletonClass
in class RubyBasicObject
public 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 Constantizable
Constantizable
public IRubyObject inspect()
RubyBasicObject
to_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 IRubyObject
inspect
in class RubyBasicObject
public IRubyObject inspect(ThreadContext context)
@Deprecated public IRubyObject inspect19(ThreadContext context)
public IRubyObject to_s()
RubyBasicObject
to_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 RubyBasicObject
public IRubyObject to_s(ThreadContext context)
public IRubyObject id2name()
public IRubyObject id2name(ThreadContext context)
public RubyString asString()
RubyBasicObject
RubyBasicObject.anyToString()
is used
instead.asString
in interface IRubyObject
asString
in class RubyBasicObject
public IRubyObject op_eqq(ThreadContext context, IRubyObject other)
RubyObject
op_eqq
in interface IRubyObject
op_eqq
in class RubyObject
public IRubyObject op_equal(ThreadContext context, IRubyObject other)
RubyBasicObject
op_equal
in interface IRubyObject
op_equal
in class RubyBasicObject
@Deprecated public RubyFixnum hash()
RubyBasicObject
hash
in class RubyBasicObject
public RubyFixnum hash(ThreadContext context)
public int hashCode()
RubyObject
hashCode
in class RubyObject
RubyBasicObject.hashCode()
public int getId()
public boolean equals(java.lang.Object other)
RubyObject
equals
in class RubyObject
RubyBasicObject.equals(Object)
public int compareTo(IRubyObject that)
RubyBasicObject
compareTo
in interface java.lang.Comparable<IRubyObject>
compareTo
in class RubyBasicObject
that
- 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 RubyBasicObject
public IRubyObject succ(ThreadContext context)
public IRubyObject op_cmp(ThreadContext context, IRubyObject other)
op_cmp
in class RubyBasicObject
public IRubyObject casecmp(ThreadContext context, IRubyObject other)
public IRubyObject casecmp_p(ThreadContext context, IRubyObject other)
public IRubyObject op_match(ThreadContext context, IRubyObject other)
RubyBasicObject
Regexp
and String
) to provide meaningful
pattern-match semantics.op_match
in class RubyBasicObject
public 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.IOException
public <T> T toJava(java.lang.Class<T> target)
IRubyObject
toJava
in interface IRubyObject
toJava
in class RubyBasicObject
target
- 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 EncodingCapable
public void setEncoding(org.jcodings.Encoding e)
setEncoding
in interface EncodingCapable
public static int javaStringHashCode(ByteList iso8859)
public boolean shouldMarshalEncoding()
shouldMarshalEncoding
in interface MarshalEncoding
public org.jcodings.Encoding getMarshalEncoding()
getMarshalEncoding
in interface MarshalEncoding
public static java.lang.String objectToSymbolString(IRubyObject object)
object
- the object to symbolifyCopyright © 2001-2019 JRuby. All Rights Reserved.