|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jruby.RubyObject
org.jruby.RubySymbol
public class RubySymbol
Represents a Ruby symbol (e.g. :bar)
Nested Class Summary | |
---|---|
static class |
RubySymbol.SymbolTable
|
Nested classes/interfaces inherited from class org.jruby.RubyObject |
---|
RubyObject.Finalizer, RubyObject.ObjectMethods, RubyObject.VariableTableEntry |
Field Summary |
---|
Fields inherited from class org.jruby.RubyObject |
---|
ALL_F, ERR_INSECURE_SET_INST_VAR, FALSE_F, FL_USHIFT, flags, FROZEN_F, metaClass, metaClassName, NEVER, NIL_F, OBJECT_ALLOCATOR, TAINTED_F, UNDEF, USER0_F, USER1_F, USER2_F, USER3_F, USER4_F, USER5_F, USER6_F, USER7_F, VARIABLE_TABLE_DEFAULT_CAPACITY, VARIABLE_TABLE_EMPTY_TABLE, VARIABLE_TABLE_LOAD_FACTOR, VARIABLE_TABLE_MAXIMUM_CAPACITY, variableTable, variableTableSize, variableTableThreshold |
Fields inherited from interface org.jruby.runtime.builtin.IRubyObject |
---|
NULL_ARRAY |
Method Summary | |
---|---|
static IRubyObject |
all_symbols(IRubyObject recv)
|
java.lang.String |
asJavaString()
rb_to_id |
static RubyClass |
createSymbolClass(Ruby runtime)
|
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. |
IRubyObject |
freeze()
rb_obj_freeze call-seq: obj.freeze => obj Prevents further modifications to obj. |
int |
getId()
|
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 rutning that. |
static RubySymbol |
getSymbolLong(Ruby runtime,
long id)
|
RubyFixnum |
hash()
rb_obj_id Will return the hash code of this object. |
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 |
inspect()
rb_obj_inspect call-seq: obj.inspect => string Returns a string containing a human-readable representation of obj. |
boolean |
isImmediate()
Is object immediate (def: Fixnum, Symbol, true, false, nil?). |
static RubySymbol |
newSymbol(Ruby runtime,
java.lang.String name)
|
IRubyObject |
op_eqq(ThreadContext context,
IRubyObject other)
rb_equal The Ruby "===" method is used by default in case/when statements. |
IRubyObject |
taint()
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()
|
RubyFixnum |
to_int()
|
IRubyObject |
to_s()
rb_any_to_s call-seq: obj.to_s => string Returns a string representing obj. |
IRubyObject |
to_sym()
|
static RubySymbol |
unmarshalFrom(UnmarshalStream input)
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public static RubyClass createSymbolClass(Ruby runtime)
public int getNativeTypeIndex()
RubyObject
getNativeTypeIndex
in interface CoreObjectType
getNativeTypeIndex
in class RubyObject
org.jruby.runtime.ClassInde
public java.lang.String asJavaString()
asJavaString
in interface IRubyObject
asJavaString
in class RubyObject
public final boolean eql(IRubyObject other)
eql
in interface IRubyObject
eql
in class RubyObject
public boolean isImmediate()
RubyObject
isImmediate
in interface IRubyObject
isImmediate
in class RubyObject
public RubyClass getSingletonClass()
RubyObject
getSingletonClass
in interface IRubyObject
getSingletonClass
in class RubyObject
public static RubySymbol getSymbolLong(Ruby runtime, long id)
public static RubySymbol newSymbol(Ruby runtime, java.lang.String name)
public RubyFixnum to_i()
public RubyFixnum to_int()
public IRubyObject inspect()
RubyObject
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 RubyObject
public IRubyObject to_s()
RubyObject
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 RubyObject
public IRubyObject id2name()
public IRubyObject op_eqq(ThreadContext context, IRubyObject other)
RubyObject
op_eqq
in interface IRubyObject
op_eqq
in class RubyObject
public RubyFixnum hash()
RubyObject
hash
in class RubyObject
public int hashCode()
RubyObject
hashCode
in class RubyObject
public int getId()
public boolean equals(java.lang.Object other)
RubyObject
equals
in class RubyObject
public IRubyObject to_sym()
public IRubyObject freeze()
RubyObject
TypeError
will be raised if modification is attempted.
There is no way to unfreeze a frozen object. See also
Object#frozen?
.
a = [ "a", "b", "c" ]
a.freeze
a << "z"
produces:
prog.rb:3:in `<<': can't modify frozen array (TypeError)
from prog.rb:3
freeze
in class RubyObject
public IRubyObject taint()
RubyObject
$SAFE
level is
set appropriately, many method calls which might alter the running
programs environment will refuse to accept tainted strings.
taint
in class RubyObject
public static IRubyObject all_symbols(IRubyObject recv)
public static RubySymbol unmarshalFrom(UnmarshalStream input) throws java.io.IOException
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |