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, JavaProxy, JavaProxyClass, JavaProxyClass.ProxyMethodImpl, JavaProxyConstructor, JavaProxyReflectionObject, JFFIInvoker, JRubyExecutionContextLocal, JRubyFiberLocal, JRubyObjectInputStream, JRubyThreadLocal, JZlibDeflate, JZlibInflate, JZlibRubyGzipReader, JZlibRubyGzipWriter, MapJavaProxy, MappedType, MemoryObject, MemoryPointer, MetaClass, Monitor, Mutex, 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.StringOnlyRubyHash, RubyGzipFile, RubyHash, RubyIndexError, RubyInteger, RubyInterrupt, RubyInterruptedRegexpError, RubyIO, RubyIO.RubyIOTimeoutError, RubyIOBuffer, RubyIOError, RubyIPSocket, RubyKeyError, RubyLoadError, RubyLocalJumpError, RubyMatchData, RubyMethod, RubyModule, RubyNameError, RubyNameError.RubyNameErrorMessage, RubyNil, RubyNoMatchingPatternError, RubyNoMatchingPatternKeyError, RubyNoMemoryError, RubyNoMethodError, RubyNotImplementedError, RubyNumeric, RubyObject, RubyObject.Data, RubyObjectSpace.AbstractWeakMap, RubyObjectSpace.WeakKeyMap, RubyObjectSpace.WeakMap, RubyPathname, RubyProc, RubyProcess.RubyStatus, RubyProducer, RubyRandom, RubyRandomBase, RubyRange, RubyRangeError, RubyRational, RubyRegexp, RubyRegexpError, RubyRipper, RubyRuntimeError, RubyScriptError, RubySecurityError, RubyServerSocket, RubySet, RubySet.DivideTSortHash, RubySignalException, RubySocket, RubySortedSet, RubyStandardError, RubyStopIteration, RubyString, RubyString.FString, RubyStruct, RubySymbol, RubySyntaxError, RubySyslog, RubySystemCallError, RubySystemExit, RubySystemStackError, RubyTCPServer, RubyTCPSocket, RubyThread, RubyThread.Backtrace, RubyThread.Location, RubyThreadError, RubyThreadGroup, RubyTime, RubyTypeError, RubyUDPSocket, RubyUnboundMethod, RubyUncaughtThrowError, RubyUNIXServer, RubyUNIXSocket, RubyYielder, RubyZeroDivisionError, SizedQueue, StringArraySet, Struct, StructByValue, StructLayout, StructLayout.ArrayField, StructLayout.ArrayProxy, StructLayout.CharArrayProxy, StructLayout.EnumField, StructLayout.Field, StructLayout.FunctionField, StructLayout.InnerStructField, StructLayout.NumberField, StructLayout.PointerField, 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. MRI: NIL_P macro
      Returns:
      true for nil only
    • isTrue

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

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

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

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

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

      boolean isImmediate()
      Is this an immediate object
      Returns:
      boolean
    • isSpecialConst

      boolean isSpecialConst()
      Is this a special constant
      Returns:
      boolean
    • getMetaClass

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

      RubyClass getSingletonClass()
      Retrieve self.singleton_class.
      Returns:
      the Ruby singleton class
    • singletonClass

      default RubyClass singletonClass(ThreadContext context)
    • getType

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

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

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

      boolean respondsToMissing(String string, boolean priv)
      RubyMethod respondsTo.
      Parameters:
      string - method name
      priv - private?
      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:
      string representation
    • 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()
      make this object into a string (hopefully)
      Returns:
      a string value
    • checkStringType

      IRubyObject checkStringType()
      is this a string if so return it otherwise nil
      Returns:
      nil if type check failed
    • checkArrayType

      IRubyObject checkArrayType()
      is this an array if so return it otherwise nil
      Returns:
      nil if type check failed
    • toJava

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

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

      default IRubyObject dup(ThreadContext context)
      RubyMethod dup.
      Parameters:
      context - the thread context
      Returns:
      a dup-ed object
      Since:
      10.0
    • inspect

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

      default IRubyObject inspect(ThreadContext context)
    • rbClone

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

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

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

      The id of the object
      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

      @Deprecated void addFinalizer(IRubyObject finalizer)
      Deprecated.
    • addFinalizer

      default IRubyObject addFinalizer(ThreadContext context, 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()
      how many variables?
      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()
      list of all variables
      Returns:
      a list of all variables (ivar/internal)
    • getMarshalVariableList

      default List<Variable<Object>> getMarshalVariableList()
      all marshable values
      Returns:
      a mutable list of all marshalable variables (ivar/internal)
    • marshalLiveVariables

      default void marshalLiveVariables(MarshalDumper stream, ThreadContext context, RubyOutputStream out)
    • getInstanceVariables

      InstanceVariables getInstanceVariables()
    • getInternalVariables

      InternalVariables getInternalVariables()
    • getVariableNameList

      List<String> getVariableNameList()
      list of all variable names
      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

      @Deprecated default IRubyObject checkStringType19()
      Deprecated.
      Use checkStringType() instead.
      is this a string?
      Returns:
      the string if so
    • convertToInteger

      @Deprecated default RubyInteger convertToInteger(int convertMethodIndex, String convertMethod)
      Deprecated.
      convert this object to an integer
      Parameters:
      convertMethodIndex - index
      convertMethod - conversion method name
      Returns:
      integer
      See Also:
    • isTaint

      @Deprecated boolean isTaint()
      Deprecated.
    • setTaint

      @Deprecated void setTaint(boolean taint)
      Deprecated.
    • infectBy

      Deprecated.