Package org.jruby

Class RubyObject

All Implemented Interfaces:
Serializable, Cloneable, Comparable<IRubyObject>, InstanceVariables, InternalVariables, IRubyObject, CoreObjectType
Direct Known Subclasses:
AbstractRubyMethod, Addrinfo, ArrayJavaProxyCreator, ConditionVariable, DynamicLibrary, Enums, Ifaddr, JavaObject, JavaProxy, JavaProxyReflectionObject, JRubyExecutionContextLocal, JRubyObjectInputStream, MemoryObject, Monitor, Mutex, Option, Queue, RubyArgsFile, RubyArithmeticSequence, RubyArray, RubyBinding, RubyBoolean, RubyChain, RubyClassPathVariable, RubyContinuation, RubyConverter, RubyDate, RubyDigest.DigestBase, RubyDigest.DigestClass, RubyDir, RubyEncoding, RubyEnumerator, RubyEnumerator.FeedValue, RubyException, RubyFileStat, RubyGenerator, RubyGzipFile, RubyHash, RubyIO, RubyMatchData, RubyModule, RubyNameError.RubyNameErrorMessage, RubyNil, RubyNumeric, RubyObject.Data, RubyObjectSpace.WeakMap, RubyPathname, RubyProc, RubyProcess.RubyStatus, RubyRandom, RubyRange, RubyRegexp, RubyRipper, RubySet, RubyString, RubyStringScanner, RubyStruct, RubySymbol, RubySyslog, RubyThread, RubyThread.Location, RubyThreadGroup, RubyTime, RubyYielder, StringIO, StructLayout.ArrayProxy, StructLayout.Field, ThreadFiber, TracePoint, Type, VariadicInvoker, ZStream

public class RubyObject extends RubyBasicObject
RubyObject represents the implementation of the Object class in Ruby. As such, it defines very few methods of its own, inheriting most from the included Kernel module. Methods that are implemented here, such as "initialize" should be implemented with care; reification of Ruby classes into Java classes can produce conflicting method names in rare cases. See JRUBY-5906 for an example.
See Also:
  • Field Details

    • OBJECT_ALLOCATOR

      public static final ObjectAllocator OBJECT_ALLOCATOR
      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.
      See Also:
    • IVAR_INSPECTING_OBJECT_ALLOCATOR

      public static final ObjectAllocator IVAR_INSPECTING_OBJECT_ALLOCATOR
      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.
    • REIFYING_OBJECT_ALLOCATOR

      public static final ObjectAllocator REIFYING_OBJECT_ALLOCATOR
  • Constructor Details

    • RubyObject

      public RubyObject(Ruby runtime, RubyClass metaClass)
      Standard path for object creation. Objects are entered into ObjectSpace only if ObjectSpace is enabled.
    • RubyObject

      public RubyObject(RubyClass metaClass)
      Path for objects that don't taint and don't enter objectspace.
    • RubyObject

      @Deprecated protected RubyObject(Ruby runtime, RubyClass metaClass, boolean useObjectSpace, boolean canBeTainted)
      Deprecated.
    • RubyObject

      protected RubyObject(Ruby runtime, RubyClass metaClass, boolean useObjectSpace)
      Path for objects who want to decide whether they don't want to be in ObjectSpace even when it is on. (notably used by objects being considered immediate, they'll always pass false here)
  • Method Details