public class RubySymbol extends RubyObject implements MarshalEncoding, Constantizable
Modifier and Type | Class and Description |
---|---|
static class |
RubySymbol.SymbolTable |
RubyObject.Data
RubyBasicObject.Finalizer
Modifier and Type | Field and Description |
---|---|
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_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) |
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) |
Object |
constant() |
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(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.
|
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()
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.
|
IRubyObject |
inspect(ThreadContext context) |
IRubyObject |
inspect19(ThreadContext context) |
boolean |
isImmediate()
Is object immediate (def: Fixnum, Symbol, true, false, nil?).
|
IRubyObject |
length() |
static RubySymbol |
newSymbol(Ruby runtime,
IRubyObject name) |
static RubySymbol |
newSymbol(Ruby runtime,
String name) |
static RubySymbol |
newSymbol(Ruby runtime,
String name,
org.jcodings.Encoding encoding) |
static 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) |
boolean |
shouldMarshalEncoding() |
IRubyObject |
succ(ThreadContext context) |
IRubyObject |
swapcase(ThreadContext context) |
static org.jruby.util.ByteList |
symbolBytesFromString(Ruby runtime,
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() |
Object |
toJava(Class target)
Convert the object to the specified Java class, if possible.
|
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, specificEval
addFinalizer, anyToString, asString, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callSuper, checkArrayType, checkCallMethod, checkFrozen, checkStringType, checkStringType19, compareTo, 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, getNativeTypeIndex, getObjectId, getRuntime, getSingletonClassClone, getType, getVariable, getVariableCount, getVariableList, getVariableNameList, hashyInspect, hasInstanceVariable, hasInternalVariable, hasVariables, id, 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, isSpecialConst, isTaint, isTrue, isUntrusted, kind_of_p, makeMetaClass, method_missing19, method, method19, methods, methods, methods19, nil_p, OBJ_INIT_COPY, objInitCopy, 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, 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_added19, singleton_method_removed19, singleton_method_undefined19, singleton_methods, 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, yieldUnder
public static final long symbolHashSeedK0
public ClassIndex getNativeClassIndex()
RubyObject
getNativeClassIndex
in interface CoreObjectType
getNativeClassIndex
in class RubyObject
ClassIndex
public String asJavaString()
asJavaString
in interface IRubyObject
asJavaString
in class RubyBasicObject
public String toString()
RubyObject
toString
in class RubyObject
public void associateEncoding(org.jcodings.Encoding encoding)
public final boolean eql(IRubyObject other)
eql
in interface IRubyObject
eql
in class RubyBasicObject
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)
public static RubySymbol newSymbol(Ruby runtime, IRubyObject name)
public static RubySymbol newSymbol(Ruby runtime, String name)
public static RubySymbol newSymbol(Ruby runtime, String name, org.jcodings.Encoding encoding)
public Object constant()
constant
in interface Constantizable
Constantizable
@Deprecated 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)
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 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)
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
public int getId()
public boolean equals(Object other)
RubyObject
equals
in class RubyObject
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 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 op_match19(ThreadContext context, IRubyObject other)
op_match19
in class RubyBasicObject
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 downcase(ThreadContext context)
public IRubyObject capitalize(ThreadContext context)
public IRubyObject swapcase(ThreadContext context)
public IRubyObject encoding(ThreadContext context)
public IRubyObject to_proc(ThreadContext context)
public static IRubyObject all_symbols(ThreadContext context, IRubyObject recv)
@Deprecated public static IRubyObject all_symbols(IRubyObject recv)
public static RubySymbol unmarshalFrom(UnmarshalStream input) throws IOException
IOException
public Object toJava(Class 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)
public static org.jruby.util.ByteList symbolBytesFromString(Ruby runtime, String internedSymbol)
public boolean shouldMarshalEncoding()
shouldMarshalEncoding
in interface MarshalEncoding
public org.jcodings.Encoding getMarshalEncoding()
getMarshalEncoding
in interface MarshalEncoding
public static String objectToSymbolString(IRubyObject object)
object
- the object to symbolifyCopyright © 2001-2015 JRuby. All Rights Reserved.