Interface IRubyObject

All Known Subinterfaces:
JavaProxyMethod
All Known Implementing Classes:
AbstractInvoker, AbstractMemory, AbstractRubyMethod, Addrinfo, ArrayJavaProxy, ArrayJavaProxyCreator, AutoPointer, Buffer, CallbackInfo, ConcreteJavaProxy, ConditionVariable, DynamicLibrary, DynamicLibrary.Symbol, Enums, FileDescriptorIO, Function, Ifaddr, IncludedModule, IncludedModuleWrapper, InterfaceJavaProxy, JavaArray, JavaClass, JavaObject, JavaPackage, JavaPackage.BlankSlateWrapper, JavaProxy, JavaProxyClass, JavaProxyClass.ProxyMethodImpl, JavaProxyConstructor, JavaProxyReflectionObject, JFFIInvoker, JRubyExecutionContextLocal, JRubyFiberLocal, JRubyObjectInputStream, JRubyThreadLocal, JZlibDeflate, JZlibInflate, JZlibRubyGzipReader, JZlibRubyGzipWriter, MapJavaProxy, MapJavaProxy.RubyHashMap, MappedType, MemoryObject, MemoryPointer, MetaClass, Monitor, Mutex, NativeCallbackPointer, NativeException, Option, Pointer, PrependedModule, Queue, RubyArgsFile, RubyArgumentError, RubyArithmeticSequence, RubyArray, RubyArrayOneObject, RubyArraySpecialized, RubyArrayTwoObject, RubyBasicObject, RubyBasicSocket, RubyBigDecimal, RubyBignum, RubyBinding, RubyBoolean, RubyBoolean.False, RubyBoolean.True, RubyChain, RubyClass, RubyClassPathVariable, RubyComplex, RubyConcurrencyError, RubyContinuation, RubyConverter, RubyDate, RubyDateTime, RubyDigest.DigestBase, RubyDigest.DigestClass, RubyDir, RubyDomainError, RubyEncoding, RubyEncodingError, RubyEncodingError.RubyCompatibilityError, RubyEncodingError.RubyConverterNotFoundError, RubyEncodingError.RubyInvalidByteSequenceError, RubyEncodingError.RubyUndefinedConversionError, RubyEnumerator, RubyEnumerator.FeedValue, RubyEOFError, RubyException, RubyFatal, RubyFiberError, RubyFile, RubyFileStat, RubyFixnum, RubyFloat, RubyFloatDomainError, RubyFrozenError, RubyGenerator, RubyGlobal.CaseInsensitiveStringOnlyRubyHash, RubyGlobal.ReadOnlySystemPropertiesHash, RubyGlobal.StringOnlyRubyHash, RubyGzipFile, RubyHash, RubyIndexError, RubyInteger, RubyInterrupt, RubyInterruptedRegexpError, RubyIO, RubyIOError, RubyIPSocket, RubyKeyError, RubyLoadError, RubyLocalJumpError, RubyMatchData, RubyMethod, RubyModule, RubyNameError, RubyNameError.RubyNameErrorMessage, RubyNil, RubyNoMemoryError, RubyNoMethodError, RubyNotImplementedError, RubyNumeric, RubyObject, RubyObject.Data, RubyObjectSpace.WeakMap, RubyPathname, RubyProc, RubyProcess.RubyStatus, RubyRandom, RubyRange, RubyRangeError, RubyRational, RubyRegexp, RubyRegexpError, RubyRipper, RubyRuntimeError, RubyScriptError, RubySecurityError, RubyServerSocket, RubySet, RubySet.DivideTSortHash, RubySignalException, RubySocket, RubySortedSet, RubyStandardError, RubyStopIteration, RubyString, RubyStringScanner, RubyStruct, RubySymbol, RubySyntaxError, RubySyslog, RubySystemCallError, RubySystemExit, RubySystemStackError, RubyTCPServer, RubyTCPSocket, RubyThread, RubyThread.Location, RubyThreadError, RubyThreadGroup, RubyTime, RubyTypeError, RubyUDPSocket, RubyUnboundMethod, RubyUncaughtThrowError, RubyUNIXServer, RubyUNIXSocket, RubyYielder, RubyZeroDivisionError, SizedQueue, StringArraySet, StringIO, Struct, StructByValue, StructLayout, StructLayout.ArrayField, StructLayout.ArrayProxy, StructLayout.CharArrayProxy, StructLayout.EnumField, StructLayout.Field, StructLayout.FunctionField, StructLayout.InnerStructField, StructLayout.NumberField, StructLayout.PointerField, StructLayout.StringField, Tempfile, ThreadFiber, TracePoint, Type, Type.Array, Type.Builtin, UndefinedValue, VariadicInvoker, ZStream

public interface IRubyObject
Object is the parent class of all classes in Ruby. Its methods are therefore available to all objects unless explicitly overridden.
  • Field Details

  • Method Details

    • array

      static IRubyObject[] array(int length)
    • callSuper

      @Deprecated IRubyObject callSuper(ThreadContext context, IRubyObject[] args, Block block)
      Deprecated.
    • callMethod

      IRubyObject callMethod(ThreadContext context, String name)
    • callMethod

      IRubyObject callMethod(ThreadContext context, String name, IRubyObject arg)
    • callMethod

      IRubyObject callMethod(ThreadContext context, String name, IRubyObject[] args)
    • callMethod

      IRubyObject callMethod(ThreadContext context, String name, IRubyObject[] args, Block block)
    • callMethod

      @Deprecated IRubyObject callMethod(ThreadContext context, int methodIndex, String name)
      Deprecated.
    • callMethod

      @Deprecated IRubyObject callMethod(ThreadContext context, int methodIndex, String name, IRubyObject arg)
      Deprecated.
    • checkCallMethod

      IRubyObject checkCallMethod(ThreadContext context, String name)
    • checkCallMethod

      IRubyObject checkCallMethod(ThreadContext context, JavaSites.CheckedSites sites)
    • isNil

      boolean isNil()
      Check whether this object is nil.
      Returns:
      true for nil only
    • isTrue

      boolean isTrue()
      Check whether this object is truthy.
      Returns:
      false for nil and false, true otherwise
    • isTaint

      boolean isTaint()
      RubyMethod isTaint.
      Returns:
      boolean
    • setTaint

      void setTaint(boolean taint)
      RubyMethod setTaint.
      Parameters:
      taint - the taint flag
    • infectBy

      IRubyObject infectBy(IRubyObject obj)
      Infect this object using the taint of another object.
      Parameters:
      obj -
      Returns:
      infected (self)
    • isFrozen

      boolean isFrozen()
      RubyMethod isFrozen.
      Returns:
      boolean
    • setFrozen

      void setFrozen(boolean b)
      RubyMethod setFrozen.
      Parameters:
      b -
    • isUntrusted

      boolean isUntrusted()
      RubyMethod isUntrusted.
      Returns:
      boolean
    • setUntrusted

      void setUntrusted(boolean b)
      RubyMethod setUntrusted.
      Parameters:
      b -
    • isImmediate

      boolean isImmediate()
      Returns:
    • isSpecialConst

      boolean isSpecialConst()
      Returns:
    • getMetaClass

      RubyClass getMetaClass()
      Retrieve </>self.class<.
      Returns:
      the Ruby (meta) class
    • getSingletonClass

      RubyClass getSingletonClass()
      Retrieve </>self.singleton_class<.
      Returns:
      the Ruby singleton class
    • getType

      RubyClass getType()
      RubyMethod getType.
      Returns:
      RubyClass
    • respondsTo

      boolean respondsTo(String string)
      RubyMethod respondsTo.
      Parameters:
      string -
      Returns:
      boolean
    • respondsToMissing

      boolean respondsToMissing(String string)
      RubyMethod respondsTo.
      Parameters:
      string -
      Returns:
      boolean
    • respondsToMissing

      boolean respondsToMissing(String string, boolean priv)
      RubyMethod respondsTo.
      Parameters:
      string -
      Returns:
      boolean
    • getRuntime

      Ruby getRuntime()
      RubyMethod getRuntime.
      Returns:
      the Ruby runtime this belongs to
    • getJavaClass

      Class getJavaClass()
      RubyMethod getJavaClass.
      Returns:
      Class
    • asJavaString

      String asJavaString()
      Convert the object into a symbol name if possible.
      Returns:
      String the symbol name
    • asString

      RubyString asString()
      rb_obj_as_string
      Returns:
    • convertToArray

      RubyArray convertToArray()
      Converts this Ruby object to an Array.
      Returns:
      an array value
    • convertToHash

      RubyHash convertToHash()
      Converts this Ruby object to a Hash.
      Returns:
      a hash value
    • convertToFloat

      RubyFloat convertToFloat()
      Converts this Ruby object to a Float (using to_f).
      Returns:
      a float value
    • convertToInteger

      RubyInteger convertToInteger()
      Converts this Ruby object to an Integer. Uses the default conversion method (to_int).
      Returns:
      an integer value
    • convertToInteger

      RubyInteger convertToInteger(String convertMethod)
      Converts this Ruby object to an Integer.
      Parameters:
      convertMethod - method to use e.g. to_i
      Returns:
      an integer value
    • convertToString

      RubyString convertToString()
      Converts this Ruby object to a String.
      Returns:
      a string value
    • anyToString

      IRubyObject anyToString()
      Returns:
    • checkStringType

      IRubyObject checkStringType()
      Returns:
      nil if type check failed
    • checkArrayType

      IRubyObject checkArrayType()
      Returns:
      nil if type check failed
    • toJava

      <T> T toJava(Class<T> type)
      Convert the object to the specified Java class, if possible.
      Parameters:
      type - The target type to which the object should be converted.
    • dup

      RubyMethod dup.
      Returns:
      a dup-ed object
    • inspect

      IRubyObject inspect()
      RubyMethod inspect.
      Returns:
      String
    • rbClone

      IRubyObject rbClone()
      RubyMethod clone.
      Returns:
      a cloned object
    • isModule

      boolean isModule()
      Returns:
      true if an object is Ruby Module instance (note that it will return false for Ruby Classes). If is_a? semantics is required, use (someObject instanceof RubyModule) instead.
    • isClass

      boolean isClass()
      Returns:
      true if an object is Ruby Class instance (note that it will return false for Ruby singleton classes). If is_a? semantics is required, use (someObject instanceof RubyClass/MetaClass) instead.
    • dataWrapStruct

      void dataWrapStruct(Object obj)
      Our version of Data_Wrap_Struct. This method will just set a private pointer to the object provided. This pointer is transient and will not be accessible from Ruby.
      Parameters:
      obj - the object to wrap
    • dataGetStruct

      Object dataGetStruct()
      Our version of Data_Get_Struct. Returns a wrapped data value if there is one, otherwise returns null.
      Returns:
      the object wrapped.
    • dataGetStructChecked

      @Deprecated Object dataGetStructChecked()
      Deprecated.
    • id

      Returns:
      the object id
    • op_equal

      IRubyObject op_equal(ThreadContext context, IRubyObject other)
    • op_eqq

      IRubyObject op_eqq(ThreadContext context, IRubyObject other)
    • eql

      boolean eql(IRubyObject other)
    • addFinalizer

      void addFinalizer(IRubyObject finalizer)
    • removeFinalizers

      void removeFinalizers()
    • hasVariables

      boolean hasVariables()
      Returns true if object has any variables, defined as:
      • instance variables
      • class variables
      • constants
      • internal variables, such as those used when marshalling Ranges and Exceptions
      Returns:
      true if object has any variables, else false
    • getVariableCount

      int getVariableCount()
      Returns:
      the count of all variables (ivar/cvar/constant/internal)
    • syncVariables

      @Deprecated void syncVariables(List<Variable<Object>> variables)
      Deprecated.
      Sets object's variables to those in the supplied list, removing/replacing any previously defined variables. Applies to all variable types (ivar/cvar/constant/internal).
      Parameters:
      variables - the variables to be set for object
    • syncVariables

      void syncVariables(IRubyObject source)
      Sets object's variables to those in the supplied object, removing/replacing any previously defined variables of the same name. Applies to all variable types (ivar/cvar/constant/internal).
      Parameters:
      source - the source object containing the variables to sync
    • getVariableList

      List<Variable<Object>> getVariableList()
      Returns:
      a list of all variables (ivar/cvar/constant/internal)
    • getInstanceVariables

      InstanceVariables getInstanceVariables()
    • getInternalVariables

      InternalVariables getInternalVariables()
    • getVariableNameList

      List<String> getVariableNameList()
      Returns:
      a list of all variable names (ivar/cvar/constant/internal)
    • copySpecialInstanceVariables

      void copySpecialInstanceVariables(IRubyObject clone)
    • getVariable

      Object getVariable(int index)
    • setVariable

      void setVariable(int index, Object value)
    • checkStringType19

      default IRubyObject checkStringType19()
      Deprecated.
      Use checkStringType() instead.
    • convertToInteger

      @Deprecated default RubyInteger convertToInteger(int convertMethodIndex, String convertMethod)
      Deprecated.
      Parameters:
      convertMethod -
      convertMethodIndex -
      See Also: