complex.c as of revision: 20011
setCanonicalization(boolean canonical) · also: set_canonicalizationconvert(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject clazz, org.jruby.runtime.builtin.IRubyObject[] args)convert(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject recv, org.jruby.runtime.builtin.IRubyObject arg)nucomp_s_convert
convert(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject recv, org.jruby.runtime.builtin.IRubyObject a1, org.jruby.runtime.builtin.IRubyObject a2)nucomp_s_convert
convert(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject recv, org.jruby.runtime.builtin.IRubyObject a1, org.jruby.runtime.builtin.IRubyObject a2, org.jruby.runtime.builtin.IRubyObject kwargs)nucomp_s_convert
convertCommon(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject recv, org.jruby.runtime.builtin.IRubyObject a1, org.jruby.runtime.builtin.IRubyObject a2, boolean raise)createComplexClass(org.jruby.runtime.ThreadContext context, org.jruby.RubyClass Numeric)f_divide(org.jruby.runtime.ThreadContext context, org.jruby.RubyComplex self, org.jruby.runtime.builtin.IRubyObject other, java.util.function.BiFunction<org.jruby.runtime.builtin.IRubyObject,org.jruby.runtime.builtin.IRubyObject,org.jruby.runtime.builtin.IRubyObject> func, org.jruby.runtime.CallSite id)newComplexBang(org.jruby.runtime.ThreadContext context, org.jruby.RubyClass clazz, org.jruby.runtime.builtin.IRubyObject x)newComplexCanonicalize(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject x)rb_complex_new1
newComplexCanonicalize(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject x, org.jruby.runtime.builtin.IRubyObject y)rb_complex_new
newComplexConvert(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject x)rb_Complex1
newComplexConvert(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject x, org.jruby.runtime.builtin.IRubyObject y)rb_Complex/rb_Complex2
newComplexRaw(org.jruby.Ruby runtime, org.jruby.runtime.builtin.IRubyObject x, org.jruby.runtime.builtin.IRubyObject y)rb_complex_raw
newComplexRaw(org.jruby.Ruby runtime, org.jruby.runtime.builtin.IRubyObject x)rb_complex_raw1
newComplexRawImage(org.jruby.Ruby runtime, org.jruby.runtime.builtin.IRubyObject image)newInstance(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject recv, org.jruby.runtime.builtin.IRubyObject[] args)nucomp_s_new
newInstance(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject recv, org.jruby.runtime.builtin.IRubyObject real)newInstance(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject recv, org.jruby.runtime.builtin.IRubyObject real, boolean raise)newInstance(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject recv, org.jruby.runtime.builtin.IRubyObject real, org.jruby.runtime.builtin.IRubyObject image)newInstance(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject recv, org.jruby.runtime.builtin.IRubyObject real, org.jruby.runtime.builtin.IRubyObject image, boolean raise)newInstanceBang(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject recv, org.jruby.runtime.builtin.IRubyObject[] args)nucomp_s_new_bang
newInstanceBang(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject recv, org.jruby.runtime.builtin.IRubyObject real)newInstanceBang(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject recv, org.jruby.runtime.builtin.IRubyObject real, org.jruby.runtime.builtin.IRubyObject image)newInstanceNew(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject recv, org.jruby.runtime.builtin.IRubyObject real)newInstanceNew(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject recv, org.jruby.runtime.builtin.IRubyObject real, org.jruby.runtime.builtin.IRubyObject image)polar(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject clazz, org.jruby.runtime.builtin.IRubyObject[] args)nucomp_s_polar
nucomp_abs
nucomp_abs2
nucomp_arg
checkFinite(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject value)checkInfinite(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject value)coerce(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject other)nucomp_coerce
complex_p(org.jruby.runtime.ThreadContext context)nucomp_complex_p
conjugate(org.jruby.runtime.ThreadContext context)nucomp_conjugate
demoninator(org.jruby.runtime.ThreadContext context)nucomp_denominator
eql_p(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject other)nucomp_eql_p
equals(Object other)exact_p(org.jruby.runtime.ThreadContext context)nucomp_exact_p
fdiv(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject other)nucomp_fdiv
finite_p(org.jruby.runtime.ThreadContext context)nucomp_hash
hashCode()nucomp_image
inexact_p(org.jruby.runtime.ThreadContext context)nucomp_exact_p
infinite_p(org.jruby.runtime.ThreadContext context)inspect(org.jruby.runtime.ThreadContext context)nucomp_inspect
marshal_dump(org.jruby.runtime.ThreadContext context)nucomp_marshal_dump
marshal_load(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg)nucomp_marshal_load
nucomp_negate
numerator(org.jruby.runtime.ThreadContext context)nucomp_numerator
op_add(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject other)nucomp_add
op_cmp(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject other)op_div(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject other)nucomp_div / nucomp_quo / rb_complex_div
op_equal(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject other)nucomp_equal_p
op_expt(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject other)MRI: nucomp_expt, rb_complex_pow
op_mul(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject other)nucomp_mul
op_sub(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject other)nucomp_sub
nucomp_polar
rationalize(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject[] args)nucomp_rationalize
isReal() · also: is_realnucomp_real_p
nucomp_rect
nucomp_to_c
nucomp_to_f
nucomp_to_i
nucomp_to_r
nucomp_to_s
| field | type | note |
|---|---|---|
| NULL_ARRAY | IRubyObject[] |
#checkStringType() instead.
is this a string?
Returns: the string if so
RubyMethod dup.
| name | type | description |
|---|---|---|
| context | org.jruby.runtime.ThreadContext | the thread context |
Returns: a dup-ed object
marshalLiveVariables(org.jruby.runtime.marshal.MarshalDumper stream, org.jruby.runtime.ThreadContext context, org.jruby.util.io.RubyOutputStream out)| field | type | note |
|---|---|---|
| ALL_F | int | |
| BASICOBJECT_ALLOCATOR | ObjectAllocator | Default allocator instance for all Ruby objects. The only reason to not use this allocator is if you actually need to have all instances of something be a subclass of RubyObject. |
| COMPARE_BY_IDENTITY_F | int | |
| ERR_INSECURE_SET_INST_VAR | String | The error message used when some one tries to modify an instance variable in a high security setting. |
| FALSE_F | int | |
| FL_USHIFT | int | |
| FROZEN_F | int | |
| IS_OVERLAID_F | int | |
| NEVER | IRubyObject | A value that is used as a null sentinel in among other places the RubyArray implementation. It will cause large problems to call any methods on this object. |
| NIL_F | int | This flag is a bit funny. It's used to denote that this value
is nil. It's a bit counterintuitive for a Java programmer to
not use subclassing to handle this case, since we have a
RubyNil subclass anyway. Well, the reason for it being a flag
is that the #isNil() method is called extremely often. So often
that it gives a good speed boost to make it monomorphic and
final. It turns out using a flag for this actually gives us
better performance than having a polymorphic #isNil() method. |
| REFINED_MODULE_F | int | |
| STAMP_OFFSET | long | |
| TAINTED_F | int | |
| UNDEF | IRubyObject | A value that specifies an undefined value. This value is used as a sentinel for undefined constant values, and other places where neither null nor NEVER makes sense. |
| USER0_F | int | |
| USER1_F | int | |
| USER2_F | int | |
| USER3_F | int | |
| USER4_F | int | |
| USER5_F | int | |
| USER6_F | int | |
| USER7_F | int | |
| USER8_F | int | |
| USER9_F | int | |
| USERA_F | int | |
| VAR_TABLE_OFFSET | long | |
| varTable | Object[] | variable table, lazily allocated as needed (if needed) |
| varTableStamp | int | locking stamp for Unsafe ops updating the vartable |
rb_obj_id Return the internal id of an object.
addFinalizer(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject f)Adds the specified object as a finalizer for this object.
Internal method that helps to convert any object into the format of a class name and a hex string inside of #<>.
asJavaString()rb_to_id Will try to convert this object to a String using the Ruby "to_str" if the object isn't already a String. If this still doesn't work, will throw a Ruby TypeError.
Returns: a (Java) string
rb_obj_as_string
First converts this object into a String using the "to_s"
method and returns it. If
to_s doesn't return a Ruby String, Convert#anyToString is used
instead.
callMethod(org.jruby.runtime.ThreadContext context, String name)Will invoke a named method with no arguments and no block.
callMethod(org.jruby.runtime.ThreadContext context, String name, org.jruby.runtime.builtin.IRubyObject arg)Will invoke a named method with one argument and no block with functional invocation.
callMethod(org.jruby.runtime.ThreadContext context, String name, org.jruby.runtime.builtin.IRubyObject[] args)Will invoke a named method with the supplied arguments and no block with functional invocation.
callMethod(String name, org.jruby.runtime.builtin.IRubyObject[] args)callMethod(String name, org.jruby.runtime.builtin.IRubyObject arg)callMethod(org.jruby.runtime.ThreadContext context, String name, org.jruby.runtime.builtin.IRubyObject[] args, org.jruby.runtime.Block block)Will invoke a named method with the supplied arguments and supplied block with functional invocation.
callMethod(org.jruby.runtime.ThreadContext context, int methodIndex, String name)callMethod(org.jruby.runtime.ThreadContext context, int methodIndex, String name, org.jruby.runtime.builtin.IRubyObject arg)callSuper(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject[] args, org.jruby.runtime.Block block)rb_check_array_type Returns the result of trying to convert this object to an Array with "to_ary".
checkCallMethod(org.jruby.runtime.ThreadContext context, String name)Will invoke a named method with no arguments and no block if that method or a custom method missing exists. Otherwise returns null. 1.9: rb_check_funcall
checkCallMethod(org.jruby.runtime.ThreadContext context, org.jruby.runtime.JavaSites.CheckedSites sites)Will invoke a named method with no arguments and no block if that method or a custom method missing exists. Otherwise returns null. 1.9: rb_check_funcall
checkFrozen()The actual method that checks frozen with the default frozen message from MRI.
If possible, call this instead of #testFrozen.
rb_check_string_type Tries to return a coerced string representation of this object, using "to_str". If that returns something other than a String or nil, an empty String will be returned.
isClass() · also: is_classSpecifically polymorphic method that are meant to be overridden by classes to specify that they are classes in an easy way.
Compares this Ruby object with another.
| name | type | description |
|---|---|---|
| other | org.jruby.runtime.builtin.IRubyObject | another IRubyObject |
Returns: 0 if equal, < 0 if this is less than other, > 0 if this is greater than other
Tries to convert this object to a Ruby Array using the "to_ary" method.
Returns: array representation of this
Tries to convert this object to a Ruby Float using the "to_f" method.
Returns: float representation of this
Tries to convert this object to a Ruby Hash using the "to_hash" method.
Returns: hash representation of this
Tries to convert this object to a Ruby Integer using the "to_int" method.
Returns: an integer representation of this
convertToInteger(String convertMethod)Tries to convert this object to a Ruby Integer using the supplied conversion method.
| name | type | description |
|---|---|---|
| convert_method | String | conversion method to use e.g. "to_i" |
Returns: an integer representation of this
convertToInteger(int methodIndex, String convertMethod)Tries to convert this object to a Ruby String using the "to_str" method.
Returns: a string representation of this
copyInstanceVariablesInto(org.jruby.runtime.builtin.InstanceVariables other)copySpecialInstanceVariables(org.jruby.runtime.builtin.IRubyObject clone)Lots of MRI objects keep their state in non-lookupable ivars (e:g. Range, Struct, etc). This method is responsible for dupping our java field equivalents
dataGetStruct()dataGetStructChecked()dataWrapStruct(Object obj)raw (id) strings are not properly encoded but in an iso_8859_1 form. This method will lookup properly encoded string from the symbol table.
| name | type | description |
|---|---|---|
| id | String | the id of the string |
Returns: the string of the symbol found from id
display(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject[] args)ensureInstanceVariablesSettable()Makes sure that instance variables can be set on this object, including information about whether this object is frozen. Will throw a suitable exception in that case.
method used for Hash key comparison (specialized for String, Symbol and Fixnum)
Returns: Will by default just call the Ruby method "eql?"
equal_p(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject other)rb_obj_equal Will use Java identity equality.
| name | type | description |
|---|---|---|
| context | org.jruby.runtime.ThreadContext | the thread context |
| other | org.jruby.runtime.builtin.IRubyObject | to compare with |
Returns: are they equal?
evalUnder(org.jruby.runtime.ThreadContext context, org.jruby.RubyModule under, org.jruby.RubyString src, String file, int line, org.jruby.EvalType evalType)extend(org.jruby.runtime.builtin.IRubyObject[] args)rb_obj_extend call-seq: obj.extend(module, ...) => obj Adds to _obj_ the instance methods from each module given as a parameter. module Mod def hello "Hello from Mod.\n" end end class Klass def hello "Hello from Klass.\n" end end k = Klass.new k.hello #=> "Hello from Klass.\n" k.extend(Mod) #=> #<Klass:0x401b3bc8> k.hello #=> "Hello from Mod.\n"
| name | type | description |
|---|---|---|
| args | org.jruby.runtime.builtin.IRubyObject[] | to use as modules to extend |
Returns: itself
isFalse() · also: is_falseIs this value a falsey value or not? Based on the #FALSE_F flag.
Returns: true is false
fastGetInstanceVariable(String internedName)fastGetInternalVariable(String internedName)fastHasInstanceVariable(String internedName)fastHasInternalVariable(String internedName)fastSetInstanceVariable(String internedName, org.jruby.runtime.builtin.IRubyObject value)fastSetInternalVariable(String internedName, Object value)getFFIHandle() · also: get_ffi_handlesetFFIHandle(Object value) · also: set_ffi_handleforEachInstanceVariable(java.util.function.BiConsumer<String,org.jruby.runtime.builtin.IRubyObject> accessor)forEachInstanceVariableName(java.util.function.Consumer<String> consumer)setFrozen(boolean frozen) · also: set_frozenSets whether this object is frozen or not. Shortcut for doing setFlag(FROZEN_F, frozen).
| name | type | description |
|---|---|---|
| frozen | boolean | should this object be frozen? |
isFrozen() · also: is_frozenIs this value frozen or not? Shortcut for doing getFlag(FROZEN_F).
Returns: true if this object is frozen, false otherwise
frozen_p(org.jruby.runtime.ThreadContext context)getFlag(int flag)Get the value of a custom flag on this object. The only guaranteed flags that can be sent in to this method is:
#FALSE_F#NIL_F#FROZEN_F| name | type | description |
|---|---|---|
| flag | int | the flag to get |
Returns: true if the flag is set, false otherwise
getInternalVariable(String name)getVariable(int index)hasInstanceVariable(String name)hasInternalVariable(String name)hasVariables() · also: has_variablesReturns true if object has any variables
RubyBasicObject#hash(ThreadContext) instead.
Will return the hash code of this object. In comparison to MRI, this method will use the Java identity hash code instead of using rb_obj_id, since the usage of id in JRuby will incur the cost of some. ObjectSpace maintenance.
Returns: hash value
isImmediate() · also: is_immediateIs object immediate (def: Fixnum, Symbol, true, false, nil?).
initialize(org.jruby.runtime.ThreadContext context)initialize_copy(org.jruby.runtime.builtin.IRubyObject original)org.jruby.RubyBasicObject#initialize_copy(ThreadContext, IRubyObject) instead.
| name | type | description |
|---|---|---|
| original | org.jruby.runtime.builtin.IRubyObject | object |
Returns: a copy
instance_eval(org.jruby.runtime.ThreadContext context, org.jruby.runtime.Block block)instance_eval(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg0, org.jruby.runtime.Block block)instance_eval(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg0, org.jruby.runtime.builtin.IRubyObject arg1, org.jruby.runtime.Block block)instance_eval(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg0, org.jruby.runtime.builtin.IRubyObject arg1, org.jruby.runtime.builtin.IRubyObject arg2, org.jruby.runtime.Block block)instance_eval(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject[] args, org.jruby.runtime.Block block)instance_exec(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject[] args, org.jruby.runtime.Block block)rb_obj_instance_exec call-seq: obj.instance_exec(arg...) {|var...| block } => obj Executes the given block within the context of the receiver (_obj_). In order to set the context, the variable +self+ is set to _obj_ while the code is executing, giving the code access to _obj_'s instance variables. Arguments are passed as block parameters. class Klass def initialize @secret = 99 end end k = Klass.new k.instance_exec(5) {|x| @secret+x } #=> 104
| name | type | description |
|---|---|---|
| context | org.jruby.runtime.ThreadContext | the thread context |
| args | org.jruby.runtime.builtin.IRubyObject[] | the args |
| block | org.jruby.runtime.Block | block |
Returns: the result
instance_of_p(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject type)rb_obj_is_instance_of
call-seq:
obj.instance_of?(class) => true or false
Returns true if obj is an instance of the given
class. See also Object#kind_of?.
| name | type | description |
|---|---|---|
| context | org.jruby.runtime.ThreadContext | the thread context |
| type | org.jruby.runtime.builtin.IRubyObject | the type |
Returns: true if this is instance of type
instance_variable_defined_p(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject name)rb_obj_ivar_defined
call-seq:
obj.instance_variable_defined?(symbol) => true or false
Returns true if the given instance variable is
defined in obj.
class Fred
def initialize(p1, p2)
@a, @b = p1, p2
end
end
fred = Fred.new('cat', 99)
fred.instance_variable_defined?(:@a) #=> true
fred.instance_variable_defined?("@b") #=> true
fred.instance_variable_defined?("@c") #=> false
| name | type | description |
|---|---|---|
| context | org.jruby.runtime.ThreadContext | the thread context |
| name | org.jruby.runtime.builtin.IRubyObject | of ivar |
Returns: true if defined
instance_variable_get(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject name)rb_obj_ivar_get
call-seq:
obj.instance_variable_get(symbol) => obj
Returns the value of the given instance variable, or nil if the
instance variable is not set. The @ part of the
variable name should be included for regular instance
variables. Throws a NameError exception if the
supplied symbol is not valid as an instance variable name.
class Fred
def initialize(p1, p2)
@a, @b = p1, p2
end
end
fred = Fred.new('cat', 99)
fred.instance_variable_get(:@a) #=> "cat"
fred.instance_variable_get("@b") #=> 99
| name | type | description |
|---|---|---|
| context | org.jruby.runtime.ThreadContext | the thread context |
| name | org.jruby.runtime.builtin.IRubyObject | of ivar |
Returns: value of ivar
getInstanceVariableList() · also: get_instance_variable_listGets a list of all variables in this object.
getInstanceVariableNameList() · also: get_instance_variable_name_listGets a name list of all variables in this object.
instance_variable_set(org.jruby.runtime.builtin.IRubyObject name, org.jruby.runtime.builtin.IRubyObject value)rb_obj_ivar_set call-seq: obj.instance_variable_set(symbol, obj) => obj Sets the instance variable names by symbol to object, thereby frustrating the efforts of the class's author to attempt to provide proper encapsulation. The variable did not have to exist prior to this call. class Fred def initialize(p1, p2) @a, @b = p1, p2 end end fred = Fred.new('cat', 99) fred.instance_variable_set(:@a, 'dog') #=> "dog" fred.instance_variable_set(:@c, 'cat') #=> "cat" fred.inspect #=> "#<Fred:0x401b3da8 @a=\"dog\", @b=99, @c=\"cat\">"
| name | type | description |
|---|---|---|
| name | org.jruby.runtime.builtin.IRubyObject | of ivar |
| value | org.jruby.runtime.builtin.IRubyObject | to set |
Returns: value of old set ivar
getInstanceVariables() · also: get_instance_variablesDummy method to avoid a cast, and to avoid polluting the IRubyObject interface with all the instance variable management methods.
instance_variables(org.jruby.runtime.ThreadContext context)rb_obj_instance_variables call-seq: obj.instance_variables => array Returns an array of instance variable names for the receiver. Note that simply defining an accessor does not create the corresponding instance variable. class Fred attr_accessor :a1 def initialize @iv = 3 end end Fred.new.instance_variables #=> [:"@iv"]
| name | type | description |
|---|---|---|
| context | org.jruby.runtime.ThreadContext | the thread context |
Returns: list of ivars
getInternalVariables() · also: get_internal_variablesDummy method to avoid a cast, and to avoid polluting the IRubyObject interface with all the instance variable management methods.
isBuiltin(String methodName)A method to determine whether the method named by methodName is a builtin method, i.e. a method built-in to JRuby and loaded during its core boot process.
| name | type | description |
|---|---|---|
| method_name | String | to look for. |
Returns: true if so
getJavaClass() · also: get_java_classWill return the Java interface that most closely can represent this object, when working through Java integration translations.
Returns: the true Java class of this (Ruby) object
kind_of_p(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject type)rb_obj_is_kind_of
call-seq:
obj.is_a?(class) => true or false
obj.kind_of?(class) => true or false
Returns true if class is the class of
obj, or if class is one of the superclasses of
obj or modules included in obj.
module M; end
class A
include M
end
class B < A; end
class C < B; end
b = B.new
b.instance_of? A #=> false
b.instance_of? B #=> true
b.instance_of? C #=> false
b.instance_of? M #=> false
b.kind_of? A #=> true
b.kind_of? B #=> true
b.kind_of? C #=> false
b.kind_of? M #=> true
| name | type | description |
|---|---|---|
| context | org.jruby.runtime.ThreadContext | the thread context |
| type | org.jruby.runtime.builtin.IRubyObject | the type |
Returns: true if this is kind of type
makeMetaClass(org.jruby.runtime.ThreadContext context, org.jruby.RubyClass superClass)rb_make_metaclass Will create a new meta class, insert this in the chain of classes for this specific object, and return the generated meta class.
| name | type | description |
|---|---|---|
| context | org.jruby.runtime.ThreadContext | the thread context |
| super_class | org.jruby.RubyClass | the super class |
Returns: the new meta class
makeMetaClassBootstrap(org.jruby.Ruby runtime, org.jruby.RubyClass superClass, org.jruby.RubyClass Class)This will create a new metaclass. This is only used during bootstrapping before
the initial ThreadContext is defined. Normal needs of making a metaclass should use
RubyBasicObject#makeMetaClass(ThreadContext, RubyClass)
| name | type | description |
|---|---|---|
| runtime | org.jruby.Ruby | the runtime |
| super_class | org.jruby.RubyClass | of the metaclass |
| class | org.jruby.RubyClass | a reference to Ruby Class |
Returns: the new metaclass
getMarshalVariableList() · also: get_marshal_variable_listif exist return the meta-class else return the type of the object.
setMetaClass(org.jruby.RubyClass metaClass) · also: set_meta_classMakes it possible to change the metaclass of an object. In practice, this is a simple version of Smalltalks Become, except that it doesn't work when we're dealing with subclasses. In practice it's used to change the singleton/meta class used, without changing the "real" inheritance chain.
| name | type | description |
|---|---|---|
| meta_class | org.jruby.RubyClass | the meta class to set |
method(org.jruby.runtime.builtin.IRubyObject name, org.jruby.parser.StaticScope refinedScope)method(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject name, org.jruby.parser.StaticScope refinedScope)Like #method(IRubyObject) but using the given refinement scope to search for the method.
| name | type | description |
|---|---|---|
| context | org.jruby.runtime.ThreadContext | the thread context |
| name | org.jruby.runtime.builtin.IRubyObject | the name of the method |
| refined_scope | org.jruby.parser.StaticScope | the static scope for the caller method |
Returns: method instance
methods(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject[] args)rb_obj_methods call-seq: obj.methods => array Returns a list of the names of methods publicly accessible in obj. This will include all the methods accessible in obj's ancestors. class Klass def kMethod() end end k = Klass.new k.methods[0..9] #=> ["kMethod", "freeze", "nil?", "is_a?", "class", "instance_variable_set", "methods", "extend", "__send__", "instance_eval"] k.methods.length #=> 42
| name | type | description |
|---|---|---|
| context | org.jruby.runtime.ThreadContext | the thread context |
| args | org.jruby.runtime.builtin.IRubyObject[] | include ancestors |
Returns: methods
methods(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject[] args, boolean useSymbols)isModule() · also: is_moduleSpecifically polymorphic method that are meant to be overridden by modules to specify that they are modules in an easy way.
getNativeHandle() · also: get_native_handlesetNativeHandle(Object value) · also: set_native_handlegetNativeTypeIndex() · also: get_native_type_indexisNil() · also: is_nilDoes this object represent nil? See the docs for the #NIL_F flag for more information.
rb_false
call_seq:
nil.nil? => true
<anything_else>.nil? => false
Only the object nil responds true to nil?.
| name | type | description |
|---|---|---|
| context | org.jruby.runtime.ThreadContext | the thread context |
Returns: true if nil
op_match(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg)rb_obj_pattern_match
call-seq:
obj =~ other => nil
Pattern Match---Overridden by descendents (notably
Regexp and String) to provide meaningful
pattern-match semantics.
| name | type | description |
|---|---|---|
| context | org.jruby.runtime.ThreadContext | the thread context |
| arg | org.jruby.runtime.builtin.IRubyObject | arg |
Returns: true if matches (always nil)
op_not_equal(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject other)The != method implemented for BasicObject.
| name | type | description |
|---|---|---|
| context | org.jruby.runtime.ThreadContext | thread context |
| other | org.jruby.runtime.builtin.IRubyObject | other object |
Returns: false if this == other, true otherwise
op_not_match(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg)Invert the match operator.
| name | type | description |
|---|---|---|
| context | org.jruby.runtime.ThreadContext | the thread context |
| arg | org.jruby.runtime.builtin.IRubyObject | arg |
Returns: true if they do not match
private_methods(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject[] args)protected_methods(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject[] args)public_methods(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject[] args)removeFinalizers()Remove all the finalizers for this object.
remove_instance_variable(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject name, org.jruby.runtime.Block block)rb_obj_remove_instance_variable call-seq: obj.remove_instance_variable(symbol) => obj Removes the named instance variable from obj, returning that variable's value. class Dummy attr_reader :var def initialize @var = 99 end def remove remove_instance_variable(:@var) end end d = Dummy.new d.var #=> 99 d.remove #=> 99 d.var #=> nil
| name | type | description |
|---|---|---|
| context | org.jruby.runtime.ThreadContext | the thread context |
| name | org.jruby.runtime.builtin.IRubyObject | of ivar |
| block | org.jruby.runtime.Block | the block (not used) |
Returns: value of removed ivar
removeInternalVariable(String name)respond_to_p(org.jruby.runtime.builtin.IRubyObject mname)respond_to_p(org.jruby.runtime.builtin.IRubyObject mname, org.jruby.runtime.builtin.IRubyObject includePrivate)respondsTo(String name)Does this object respond to the specified message? Uses a shortcut if it can be proved that respond_to? and respond_to_missing? haven't been overridden.
respondsToMissing(String name)Does this object respond to the specified message via "method_missing?"
respondsToMissing(String name, boolean incPrivate)Does this object respond to the specified message via "method_missing?"
Will return the runtime that this object is associated with.
Returns: current runtime
send(org.jruby.runtime.ThreadContext context, org.jruby.runtime.Block block)send(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg0, org.jruby.runtime.Block block)send(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg0, org.jruby.runtime.builtin.IRubyObject arg1, org.jruby.runtime.Block block)send(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg0, org.jruby.runtime.builtin.IRubyObject arg1, org.jruby.runtime.builtin.IRubyObject arg2, org.jruby.runtime.Block block)send(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject[] args, org.jruby.runtime.Block block)setFlag(int flag, boolean set)Sets or unsets a flag on this object. The only flags that are guaranteed to be valid to use as the first argument is:
#FALSE_F#NIL_F#FROZEN_F| name | type | description |
|---|---|---|
| flag | int | the actual flag to set or unset. |
| set | boolean | if true, the flag will be set, if false, the flag will be unset. |
setInstanceVariable(String name, org.jruby.runtime.builtin.IRubyObject value)rb_iv_set / rb_ivar_set
setInternalVariable(String name, Object value)setVariable(int index, Object value)singletonClass(org.jruby.runtime.ThreadContext context)Will either return the existing singleton class for this object, or create a new one and return that. For a few types a singleton class is not possible so it will throw an error.
| name | type | description |
|---|---|---|
| context | org.jruby.runtime.ThreadContext | the current thread context |
Returns: the singleton of this type
singleton_method(org.jruby.runtime.builtin.IRubyObject name)singleton_method(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject name)singleton_methods(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject[] args)isSpecialConst() · also: is_special_constisSpecialObject() · also: is_special_objectspecificEval(org.jruby.runtime.ThreadContext context, org.jruby.RubyModule mod, org.jruby.runtime.Block block, org.jruby.EvalType evalType)specific_eval Evaluates the block or string inside of the context of this object, using the supplied arguments. If a block is given, this will be yielded in the specific context of this object. If no block is given then a String-like object needs to be the first argument, and this string will be evaluated. Second and third arguments in the args-array is optional, but can contain the filename and line of the string under evaluation.
| name | type | description |
|---|---|---|
| context | org.jruby.runtime.ThreadContext | the thread context |
| mod | org.jruby.RubyModule | module to yield in |
| block | org.jruby.runtime.Block | to call |
| eval_type | org.jruby.EvalType | type of evaal to perform |
Returns: the result
specificEval(org.jruby.runtime.ThreadContext context, org.jruby.RubyModule mod, org.jruby.runtime.builtin.IRubyObject arg, org.jruby.runtime.Block block, org.jruby.EvalType evalType)specific_eval Evaluates the block or string inside of the context of this object, using the supplied arguments. If a block is given, this will be yielded in the specific context of this object. If no block is given then a String-like object needs to be the first argument, and this string will be evaluated. Second and third arguments in the args-array is optional, but can contain the filename and line of the string under evaluation.
| name | type | description |
|---|---|---|
| context | org.jruby.runtime.ThreadContext | the thread context |
| mod | org.jruby.RubyModule | module to yield in |
| arg | org.jruby.runtime.builtin.IRubyObject | to pass to block |
| block | org.jruby.runtime.Block | to call |
| eval_type | org.jruby.EvalType | type of evaal to perform |
Returns: the result
specificEval(org.jruby.runtime.ThreadContext context, org.jruby.RubyModule mod, org.jruby.runtime.builtin.IRubyObject arg0, org.jruby.runtime.builtin.IRubyObject arg1, org.jruby.runtime.Block block, org.jruby.EvalType evalType)specific_eval Evaluates the block or string inside of the context of this object, using the supplied arguments. If a block is given, this will be yielded in the specific context of this object. If no block is given then a String-like object needs to be the first argument, and this string will be evaluated. Second and third arguments in the args-array is optional, but can contain the filename and line of the string under evaluation.
| name | type | description |
|---|---|---|
| context | org.jruby.runtime.ThreadContext | the thread context |
| mod | org.jruby.RubyModule | module to yield in |
| arg0 | org.jruby.runtime.builtin.IRubyObject | to pass to block |
| arg1 | org.jruby.runtime.builtin.IRubyObject | to pass to block |
| block | org.jruby.runtime.Block | to call |
| eval_type | org.jruby.EvalType | type of evaal to perform |
Returns: the result
specificEval(org.jruby.runtime.ThreadContext context, org.jruby.RubyModule mod, org.jruby.runtime.builtin.IRubyObject arg0, org.jruby.runtime.builtin.IRubyObject arg1, org.jruby.runtime.builtin.IRubyObject arg2, org.jruby.runtime.Block block, org.jruby.EvalType evalType)specific_eval Evaluates the block or string inside of the context of this object, using the supplied arguments. If a block is given, this will be yielded in the specific context of this object. If no block is given then a String-like object needs to be the first argument, and this string will be evaluated. Second and third arguments in the args-array is optional, but can contain the filename and line of the string under evaluation.
| name | type | description |
|---|---|---|
| context | org.jruby.runtime.ThreadContext | the thread context |
| mod | org.jruby.RubyModule | module to yield in |
| arg0 | org.jruby.runtime.builtin.IRubyObject | to pass to block |
| arg1 | org.jruby.runtime.builtin.IRubyObject | to pass to block |
| arg2 | org.jruby.runtime.builtin.IRubyObject | to pass to block |
| block | org.jruby.runtime.Block | to call |
| eval_type | org.jruby.EvalType | type of evaal to perform |
Returns: the result
syncVariables(org.jruby.runtime.builtin.IRubyObject other)Sync one this object's variables with other's - this is used to make rbClone work correctly.
syncVariables(List<org.jruby.runtime.builtin.Variable<Object>> variables)setTaint(boolean taint) · also: set_taintisTaint() · also: is_tainttainted_p(org.jruby.runtime.ThreadContext context)RubyBasicObject#to_s(ThreadContext) instead.
Returns: ""
isTrue() · also: is_trueIs this value a truthy value or not? Based on the #FALSE_F flag.
Returns: true it truthy
rb_obj_class Returns the real class of this object, excluding any singleton/meta class in the inheritance chain.
Returns: the real class
untaint(org.jruby.runtime.ThreadContext context)untrust(org.jruby.runtime.ThreadContext context)setUntrusted(boolean untrusted) · also: set_untrustedisUntrusted() · also: is_untrusteduntrusted_p(org.jruby.runtime.ThreadContext context)getVariableCount() · also: get_variable_countGets a list of all variables in this object.
getVariableNameList() · also: get_variable_name_listGets a name list of all variables in this object.
| field | type | note |
|---|---|---|
| IVAR_INSPECTING_OBJECT_ALLOCATOR | ObjectAllocator | Allocator that inspects all methods for instance variables and chooses a concrete class to construct based on that. This allows using specialized subclasses to hold instance variables in fields rather than always holding them in an array. |
| OBJECT_ALLOCATOR | ObjectAllocator | Default allocator instance for all Ruby objects. The only reason to not use this allocator is if you actually need to have all instances of something be a subclass of RubyObject. |
| REIFYING_OBJECT_ALLOCATOR | ObjectAllocator |
attachToObjectSpace()Will make sure that this object is added to the current object space.
callInit(org.jruby.runtime.builtin.IRubyObject[] args, org.jruby.runtime.Block block)Call the Ruby initialize method with the supplied arguments and block.
| name | type | description |
|---|---|---|
| args | org.jruby.runtime.builtin.IRubyObject[] | args |
| block | org.jruby.runtime.Block | block |
Call the Ruby initialize method with the supplied arguments and block.
| name | type | description |
|---|---|---|
| block | org.jruby.runtime.Block | block |
callInit(org.jruby.runtime.builtin.IRubyObject arg0, org.jruby.runtime.Block block)Call the Ruby initialize method with the supplied arguments and block.
| name | type | description |
|---|---|---|
| arg0 | org.jruby.runtime.builtin.IRubyObject | arg0 |
| block | org.jruby.runtime.Block | block |
callInit(org.jruby.runtime.builtin.IRubyObject arg0, org.jruby.runtime.builtin.IRubyObject arg1, org.jruby.runtime.Block block)Call the Ruby initialize method with the supplied arguments and block.
| name | type | description |
|---|---|---|
| arg0 | org.jruby.runtime.builtin.IRubyObject | arg0 |
| arg1 | org.jruby.runtime.builtin.IRubyObject | arg1 |
| block | org.jruby.runtime.Block | block |
callInit(org.jruby.runtime.builtin.IRubyObject arg0, org.jruby.runtime.builtin.IRubyObject arg1, org.jruby.runtime.builtin.IRubyObject arg2, org.jruby.runtime.Block block)callInit(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject[] args, org.jruby.runtime.Block block)callInit(org.jruby.runtime.ThreadContext context, org.jruby.runtime.Block block)callInit(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg0, org.jruby.runtime.Block block)callInit(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg0, org.jruby.runtime.builtin.IRubyObject arg1, org.jruby.runtime.Block block)callInit(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg0, org.jruby.runtime.builtin.IRubyObject arg1, org.jruby.runtime.builtin.IRubyObject arg2, org.jruby.runtime.Block block)convertToType(org.jruby.RubyClass target, int convertMethodIndex)op_eqq(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject other)rb_equal The Ruby "===" method is used by default in case/when statements. The Object implementation first checks Java identity equality and then calls the "==" method too.
specificEval(org.jruby.runtime.ThreadContext context, org.jruby.RubyModule mod, org.jruby.runtime.builtin.IRubyObject[] args, org.jruby.runtime.Block block, org.jruby.EvalType evalType)toRubyString(org.jruby.runtime.ThreadContext context)The default toString method is just a wrapper that calls the Ruby "to_s" method. This will raise if it is not actually a Ruby String.
| name | type | description |
|---|---|---|
| context | org.jruby.runtime.ThreadContext | thread context this is executing on. |
Returns: the string.
toString()The default toString method is just a wrapper that calls the Ruby "to_s" method.
Returns: string representation
| field | type | note |
|---|---|---|
| DBL_EPSILON | double |
asBigInteger(org.jruby.runtime.ThreadContext context)Return a BigInteger representation of this numerical value
| name | type | description |
|---|---|---|
| context | org.jruby.runtime.ThreadContext | the current thread context |
Returns: a BigInteger
Return a double representation of this numerical value
| name | type | description |
|---|---|---|
| context | org.jruby.runtime.ThreadContext | the current thread context |
Returns: a double
Returns the value of this numeric and a java int.
Return the value of this numeric as a 64-bit long.
getBigIntegerValue() · also: get_big_integer_valuecallCoerced(org.jruby.runtime.ThreadContext context, String method, org.jruby.runtime.builtin.IRubyObject other)callCoerced(org.jruby.runtime.ThreadContext context, org.jruby.runtime.CallSite site, org.jruby.runtime.builtin.IRubyObject other)MRI: num_ceil
org.jruby.RubyNumeric#coerce(ThreadContext, IRubyObject) instead.
convertToRational(org.jruby.runtime.ThreadContext context)denominator(org.jruby.runtime.ThreadContext context)numeric_denominator
div(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject other)MRI: num_div
divmod(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject other)num_divmod
getDoubleValue() · also: get_double_valueorg.jruby.RubyNumeric#asDouble(ThreadContext) instead.
MRI: num_floor
idiv(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject other)MRI: rb_int_idiv and overrides
idiv(org.jruby.runtime.ThreadContext context, long other)initialize_copy(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg)num_init_copy
getIntValue() · also: get_int_valueorg.jruby.RubyNumeric#asInt(ThreadContext) instead.
Return the value of this numeric as a 32-bit long. If the value does not fit in 32 bits, it will be truncated.
integer_p(org.jruby.runtime.ThreadContext context)num_int_p
isNegative(org.jruby.runtime.ThreadContext context)num_negative_p
isNegativeNumber(org.jruby.runtime.ThreadContext context)isPositive(org.jruby.runtime.ThreadContext context)num_positive_p
isPositiveNumber(org.jruby.runtime.ThreadContext context)getLongValue() · also: get_long_valueorg.jruby.RubyNumeric#asLong(ThreadContext) instead.
Return the value of this numeric as a 64-bit long. If the value does not fit in 64 bits, it will be truncated.
magnitude(org.jruby.runtime.ThreadContext context)num_abs/1.9
modulo(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject other)num_modulo
isNegative() · also: is_negativeorg.jruby.RubyNumeric#isNegativeNumber(ThreadContext) instead.
nonzero_p(org.jruby.runtime.ThreadContext context)num_nonzero_p
num_imaginary(org.jruby.runtime.ThreadContext context)num_imaginary
numRemainder(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject y)op_minus(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject other)op_plus(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject other)op_uminus(org.jruby.runtime.ThreadContext context)num_uminus
op_uplus(org.jruby.runtime.ThreadContext context)num_uplus
isPositive() · also: is_positiveorg.jruby.RubyNumeric#isPositiveNumber(ThreadContext) instead.
quo(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject other)num_quo
rbClone(org.jruby.runtime.builtin.IRubyObject[] args)rbClone(org.jruby.runtime.ThreadContext context)rbClone(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject arg)remainder(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject y)num_remainder
MRI: num_round
step(org.jruby.runtime.ThreadContext context, org.jruby.runtime.builtin.IRubyObject[] args, org.jruby.runtime.Block block)num_step
num_to_int
toJava(Class<T> target)truncate(org.jruby.runtime.ThreadContext context)MRI: num_truncate
isZero() · also: is_zeroorg.jruby.RubyNumeric#isZero(ThreadContext) instead.
num_zero_p