org.jruby
Class RubySymbol

java.lang.Object
  extended by org.jruby.RubyObject
      extended by org.jruby.RubySymbol
All Implemented Interfaces:
java.lang.Cloneable, IRubyObject

public class RubySymbol
extends RubyObject

Author:
jpetersen

Nested Class Summary
static class RubySymbol.SymbolTable
           
 
Nested classes/interfaces inherited from class org.jruby.RubyObject
RubyObject.Finalizer
 
Field Summary
static byte EQUALEQUAL_SWITCHVALUE
           
static byte HASH_SWITCHVALUE
           
static byte INSPECT_SWITCHVALUE
           
static byte NIL_P_SWITCHVALUE
           
static byte TO_I_SWITCHVALUE
           
static byte TO_S_SWITCHVALUE
           
static byte TO_SYM_SWITCHVALUE
           
 
Fields inherited from class org.jruby.RubyObject
instanceVariables, isTrue, metaClass, NEVER, OBJECT_ALLOCATOR
 
Fields inherited from interface org.jruby.runtime.builtin.IRubyObject
NULL_ARRAY
 
Method Summary
static IRubyObject all_symbols(IRubyObject recv)
           
 java.lang.String asSymbol()
          rb_to_id
 IRubyObject callMethod(ThreadContext context, RubyModule rubyclass, int methodIndex, java.lang.String name, IRubyObject[] args, CallType callType, Block block)
           
static RubyClass createSymbolClass(Ruby runtime)
           
 boolean eql(IRubyObject other)
          short circuit for Symbol key comparison
 IRubyObject equal(IRubyObject other)
          rb_equal
 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.
 IRubyObject freeze()
          Freeze an object.
 int getNativeTypeIndex()
          This is overridden in the other concrete Java builtins to provide a fast way to determine what type they are.
static java.lang.String getSymbol(Ruby runtime, long id)
           
 RubyFixnum hash()
           
 int hashCode()
           
 IRubyObject inspect()
          rb_obj_inspect
 boolean isImmediate()
           
static RubySymbol newSymbol(Ruby runtime, java.lang.String name)
           
 IRubyObject taint()
          rb_obj_taint
 RubyFixnum to_i()
           
 IRubyObject to_s()
           
 IRubyObject to_sym()
           
static RubySymbol unmarshalFrom(UnmarshalStream input)
           
 
Methods inherited from class org.jruby.RubyObject
addFinalizer, anyToString, asString, attachToObjectSpace, callInit, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethodMissing, callMethodMissing, callSuper, checkArrayType, checkFrozen, checkStringType, compilerCallMethod, compilerCallMethodWithIndex, convertToArray, convertToFloat, convertToHash, convertToInteger, convertToString, convertToType, convertToType, convertToType, convertToTypeWithCheck, createObjectClass, dataGetStruct, dataWrapStruct, display, doClone, dup, eqlInternal, equalInternal, evalSimple, evalUnder, evalWithBinding, extend, frozen, getInstanceVariable, getInstanceVariables, getInstanceVariablesSnapshot, getJavaClass, getMetaClass, getRuntime, getSingletonClass, getSingletonClassClone, getType, id_deprecated, id, infectBy, inherited, initCopy, initialize_copy, initialize, instance_eval, instance_exec, instance_of, instance_variable_get, instance_variable_set, instance_variables, instanceVariableNames, isFalse, isFrozen, isKindOf, isNil, isSingleton, isTaint, isTrue, kind_of, makeMetaClass, match, method, methods, nil_p, obj_equal, private_methods, protected_methods, public_methods, puts, rbClone, remove_instance_variable, removeFinalizers, removeInstanceVariable, respond_to, respondsTo, safeGetInstanceVariables, safeHasInstanceVariables, send, setFrozen, setInstanceVariable, setInstanceVariable, setInstanceVariables, setMetaClass, setTaint, singleton_methods, specificEval, tainted, testFrozen, toString, trueFalseNil, trueFalseNil, type_deprecated, type, untaint
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NIL_P_SWITCHVALUE

public static final byte NIL_P_SWITCHVALUE
See Also:
Constant Field Values

EQUALEQUAL_SWITCHVALUE

public static final byte EQUALEQUAL_SWITCHVALUE
See Also:
Constant Field Values

TO_S_SWITCHVALUE

public static final byte TO_S_SWITCHVALUE
See Also:
Constant Field Values

TO_I_SWITCHVALUE

public static final byte TO_I_SWITCHVALUE
See Also:
Constant Field Values

TO_SYM_SWITCHVALUE

public static final byte TO_SYM_SWITCHVALUE
See Also:
Constant Field Values

HASH_SWITCHVALUE

public static final byte HASH_SWITCHVALUE
See Also:
Constant Field Values

INSPECT_SWITCHVALUE

public static final byte INSPECT_SWITCHVALUE
See Also:
Constant Field Values
Method Detail

createSymbolClass

public static RubyClass createSymbolClass(Ruby runtime)

getNativeTypeIndex

public int getNativeTypeIndex()
Description copied from class: RubyObject
This is overridden in the other concrete Java builtins to provide a fast way to determine what type they are.

Specified by:
getNativeTypeIndex in interface IRubyObject
Overrides:
getNativeTypeIndex in class RubyObject
Returns:
the ClassIndex of the native type this object was constructed from

callMethod

public IRubyObject callMethod(ThreadContext context,
                              RubyModule rubyclass,
                              int methodIndex,
                              java.lang.String name,
                              IRubyObject[] args,
                              CallType callType,
                              Block block)
Specified by:
callMethod in interface IRubyObject
Overrides:
callMethod in class RubyObject
Returns:

asSymbol

public java.lang.String asSymbol()
rb_to_id

Specified by:
asSymbol in interface IRubyObject
Overrides:
asSymbol in class RubyObject
Returns:
a String representation of the symbol

eql

public final boolean eql(IRubyObject other)
short circuit for Symbol key comparison

Specified by:
eql in interface IRubyObject
Overrides:
eql in class RubyObject

isImmediate

public boolean isImmediate()
Specified by:
isImmediate in interface IRubyObject
Overrides:
isImmediate in class RubyObject
Returns:

getSymbol

public static java.lang.String getSymbol(Ruby runtime,
                                         long id)

newSymbol

public static RubySymbol newSymbol(Ruby runtime,
                                   java.lang.String name)

equal

public IRubyObject equal(IRubyObject other)
Description copied from class: RubyObject
rb_equal

Specified by:
equal in interface IRubyObject
Overrides:
equal in class RubyObject

to_i

public RubyFixnum to_i()

inspect

public IRubyObject inspect()
Description copied from class: RubyObject
rb_obj_inspect

Specified by:
inspect in interface IRubyObject
Overrides:
inspect in class RubyObject
Returns:
String

to_s

public IRubyObject to_s()
Overrides:
to_s in class RubyObject

hash

public RubyFixnum hash()
Overrides:
hash in class RubyObject

hashCode

public int hashCode()
Overrides:
hashCode in class RubyObject

equals

public boolean equals(java.lang.Object other)
Description copied from class: RubyObject
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.

Overrides:
equals in class RubyObject

to_sym

public IRubyObject to_sym()

freeze

public IRubyObject freeze()
Description copied from class: RubyObject
Freeze an object. rb_obj_freeze

Overrides:
freeze in class RubyObject

taint

public IRubyObject taint()
Description copied from class: RubyObject
rb_obj_taint

Overrides:
taint in class RubyObject

all_symbols

public static IRubyObject all_symbols(IRubyObject recv)

unmarshalFrom

public static RubySymbol unmarshalFrom(UnmarshalStream input)
                                throws java.io.IOException
Throws:
java.io.IOException


Copyright © 2002-2007 JRuby Team. All Rights Reserved.