Package org.jruby
Class RubyModule
java.lang.Object
org.jruby.RubyBasicObject
org.jruby.RubyObject
org.jruby.RubyModule
- All Implemented Interfaces:
Serializable,Cloneable,Comparable<IRubyObject>,InstanceVariables,InternalVariables,IRubyObject,CoreObjectType
- Direct Known Subclasses:
JavaPackage,RubyClass
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionfinal classObjects for holding autoload state for the defined constant.static interfaceDeprecated.protected static classstatic classRepresents a constant value, possibly hidden (private).static final classstatic classstatic final classstatic classDeprecated.protected static classstatic classprotected static classprotected static classA wrapper CacheEntryFactory, for delegating cache entry creation along a chain.Nested classes/interfaces inherited from class org.jruby.RubyObject
RubyObject.DataNested classes/interfaces inherited from class org.jruby.RubyBasicObject
RubyBasicObject.Finalizer -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Map<RubyModule,IncludedModule> A list of refinement hosts for this refinementprivate Map<String,RubyModule.Autoload> protected StringThe base name of this class/module, excluding nesting.protected Map<String,CacheEntry> private StringThe cached name, full class name e.g.private RubyStringprivate RubyModule.CacheEntryFactorystatic final intprotected ClassIndexprivate Set<ClassProvider>private Map<String,IRubyObject> private static final AtomicReferenceFieldUpdater<RubyModule,Map> private Map<String,RubyModule.ConstantEntry> private RubyModuleThe module where this refinement was definedprotected intprotected Integerfinal intprivate MethodHandlePre-built test that takes ThreadContext, IRubyObject and checks that the object is a module with the same ID as this one.static final intintDeprecated.use RubyModule#getClassIndex()static final intprivate booleanWhether this class proxies a normal Java classprivate static final Loggerprivate static final MethodHandles.Lookupprotected final Invalidatorprotected RubyModuleWhere are the methods of this module/class located? This only happens as a result of prepend (see PrependedModule) where it moves all methods to a PrependedModule which will be beneath the actual module which was prepended.protected Map<String,DynamicMethod> static final ObjectAllocatorstatic final intprotected static final RubyModule.CacheEntryFactorystatic final intThe class/module within whose namespace this class/module resides.static final int(package private) RubyModuleThe class this refinement refinesprivate Map<RubyModule,RubyModule> Refinements added to this module are stored hereDeprecated.protected RubyClassprivate static final MethodHandleA handle for invoking the module ID test, to be reused for all idTest handles below.Fields inherited from class org.jruby.RubyObject
IVAR_INSPECTING_OBJECT_ALLOCATOR, OBJECT_ALLOCATOR, REIFYING_OBJECT_ALLOCATORFields inherited from class org.jruby.RubyBasicObject
ALL_F, BASICOBJECT_ALLOCATOR, COMPARE_BY_IDENTITY_F, ERR_INSECURE_SET_INST_VAR, FALSE_F, FL_USHIFT, flags, FROZEN_F, metaClass, NEVER, NIL_F, STAMP_OFFSET, TAINTED_F, UNDEF, UNTRUST_F, USER0_F, USER1_F, USER2_F, USER3_F, USER4_F, USER5_F, USER6_F, USER7_F, USER8_F, USER9_F, USERA_F, VAR_TABLE_OFFSET, varTable, varTableStampFields inherited from interface org.jruby.runtime.builtin.IRubyObject
NULL_ARRAY -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedRubyModule(Ruby runtime) standard path for Module constructionprotectedRubyModule(Ruby runtime, RubyClass metaClass) used by MODULE_ALLOCATOR and RubyClass constructorsprotectedRubyModule(Ruby runtime, RubyClass metaClass, boolean objectSpace) separate path for MetaClass construction -
Method Summary
Modifier and TypeMethodDescriptionprivate voidaddAccessor(ThreadContext context, RubySymbol identifier, Visibility visibility, boolean readable, boolean writeable) private voidaddActivatedRefinement(ThreadContext context, RubyModule moduleToRefine, RubyModule refinement) final voidaddClassProvider(ClassProvider provider) voidaddIncludingHierarchy(IncludedModule hierarchy) voidaddMethod(String id, DynamicMethod method) final voidaddMethodAtBootTimeOnly(String id, DynamicMethod method) Deprecated.No longer used, internal API!final voidaddMethodInternal(String name, DynamicMethod method) protected voidaddMethodSymbols(Ruby runtime, Set<String> seen, RubyArray ary, boolean not, Visibility visibility) voidaddModuleFunction(String name, DynamicMethod method) voidaddReadAttribute(ThreadContext context, String name) voidaddReadWriteAttribute(ThreadContext context, String name) private voidaddRefinedMethodEntry(String id, DynamicMethod method) protected CacheEntryaddToCache(String id, DynamicMethod method, RubyModule sourceModule, int token) protected CacheEntryaddToCache(String id, CacheEntry entry) voidaddWriteAttribute(ThreadContext context, String name) alias_method(ThreadContext context, IRubyObject newId, IRubyObject oldId) Deprecated.ancestors(ThreadContext context) rb_mod_ancestorsappend_features(IRubyObject include) rb_mod_append_featuresattr(ThreadContext context, IRubyObject[] args) rb_mod_attrattr_accessor(IRubyObject[] args) Deprecated.attr_accessor(ThreadContext context, IRubyObject[] args) rb_mod_attr_accessor Note: this method should not be called from Java in most cases, since it depends on Ruby frame state for visibility.attr_reader(IRubyObject[] args) Deprecated.attr_reader(ThreadContext context, IRubyObject[] args) rb_mod_attr_readerattr_writer(ThreadContext context, IRubyObject[] args) rb_mod_attr_writerattr19(ThreadContext context, IRubyObject[] args) Deprecated.autoload(ThreadContext context, IRubyObject symbol, IRubyObject file) autoload_p(ThreadContext context, IRubyObject symbol) booleanautoloadingValue(Ruby runtime, String name) voidprivate CacheEntryprivate Stringprivate RubyStringprivate StringRecalculate the fully-qualified name of this class/module.private RubyStringprivate RaiseExceptionprivate voidcheckAliasFrameAccesses(Ruby runtime, String id, String newName, DynamicMethod method) private voidprivate RubyStringcheckAutoloadRequired(Ruby runtime, String name, String[] autoloadPath) private voidprotected voidfinal voidThe actual method that checks frozen with the default frozen message from MRI.private VisibilitycheckMethodVisibility(ThreadContext context, IRubyObject symbol, boolean parents) private voidcheckSafeTypeToCopy(RubyClass original) voidcheckValidBindTargetFrom(ThreadContext context, RubyModule originModule, boolean fromBind) class_variable_defined_p(ThreadContext context, IRubyObject var) rb_mod_cvar_getclass_variable_set(IRubyObject name, IRubyObject value) rb_mod_cvar_setclass_variable_set19(IRubyObject name, IRubyObject value) class_variables(ThreadContext context) class_variables(ThreadContext context, IRubyObject inherit) class_variables19(ThreadContext context) Deprecated.private Collection<String>classVariablesCommon(boolean inherit) protected final IRubyObjectcloneMethods(RubyModule clone) const_defined_p(ThreadContext context, IRubyObject name) rb_mod_const_definedconst_defined_p(ThreadContext context, IRubyObject name, IRubyObject recurse) const_defined_p19(ThreadContext context, IRubyObject[] args) Deprecated.const_get(IRubyObject symbol) const_get(ThreadContext context, IRubyObject... args) rb_mod_const_getconst_get_1_9(ThreadContext context, IRubyObject[] args) Deprecated.const_get_2_0(ThreadContext context, IRubyObject[] args) Deprecated.const_missing(ThreadContext context, IRubyObject rubyName, Block block) Base implementation of Module#const_missing, throws NameError for specific missing constant.const_set(IRubyObject name, IRubyObject value) rb_mod_const_setprotected RubyModule.ConstantEntryconstantEntryFetch(String name) constants(ThreadContext context) constants(ThreadContext context, IRubyObject allConstants) constants19(ThreadContext context) Deprecated.constants19(ThreadContext context, IRubyObject allConstants) Deprecated.constantsCommon(Ruby runtime, boolean replaceModule, boolean allConstants) rb_mod_constantsconstantsCommon(Ruby runtime, boolean replaceModule, boolean allConstants, boolean includePrivate) private RubyArrayconstantsCommon(ThreadContext context, boolean replaceModule, boolean allConstants) constantsCommon19(ThreadContext context, boolean replaceModule, boolean allConstants) Deprecated.protected booleanconstantTableContains(String name) protected IRubyObjectconstantTableFetch(String name) protected IRubyObjectconstantTableRemove(String name) protected IRubyObjectconstantTableStore(String name, IRubyObject value) protected IRubyObjectconstantTableStore(String name, IRubyObject value, boolean hidden) protected IRubyObjectconstantTableStore(String name, IRubyObject value, boolean hidden, boolean deprecated) booleanconstDefined(String name) private booleanconstDefined(Ruby runtime, IRubyObject name, boolean inherit) booleanconstDefinedAt(String name) booleanconstDefinedFrom(String name) private booleanconstDefinedInner(String name, boolean exclude, boolean recurse, boolean visibility) rb_const_defined_0static RubyClasscreateModuleClass(Ruby runtime, RubyClass moduleClass) private RubyModulecreateNewRefinedModule(ThreadContext context, RubyModule klass) private DynamicMethodcreateProcMethod(Ruby runtime, String name, Visibility visibility, Block block) private CacheEntrydeepMethodSearch(String id, Ruby runtime) private static voiddefine(RubyModule module, JavaMethodDescriptor desc, String simpleName, DynamicMethod dynamicMethod) define_method(ThreadContext context, IRubyObject[] args, Block block) Deprecated.define_method(ThreadContext context, IRubyObject arg0, Block block) define_method(ThreadContext context, IRubyObject arg0, IRubyObject arg1, Block block) voiddefineAlias(String name, String oldName) rb_aliasvoiddefineAliases(List<String> aliases, String oldId) Deprecated.final booleandefineAnnotatedConstant(Field field) final voiddefineAnnotatedConstants(Class clazz) voiddefineAnnotatedMethod(Class clazz, String name) final booleandefineAnnotatedMethod(Method method, MethodFactory methodFactory) final booleandefineAnnotatedMethod(String name, List<JavaMethodDescriptor> methods, MethodFactory methodFactory) final booleandefineAnnotatedMethod(String name, JavaMethodDescriptor desc, MethodFactory methodFactory) voiddefineAnnotatedMethods(Class clazz) final voidprotected final voiddefineAutoload(String symbol, RubyString path) Define an autoload.defineClassUnder(String name, RubyClass superClass, ObjectAllocator allocator) rb_define_class_under this method should be used only as an API to define/open nested classesvoiddefineConstant(String name, IRubyObject value) rb_define_constdefineMethodFromBlock(ThreadContext context, IRubyObject arg0, Block block, Visibility visibility) defineMethodFromCallable(ThreadContext context, IRubyObject arg0, IRubyObject arg1, Visibility visibility) defineModuleUnder(String name) rb_define_module_under this method should be used only as an API to define/open nested moduledefineOrGetClassUnder(String name, RubyClass superClazz) this method should be used only by interpreter or compilerdefineOrGetClassUnder(String name, RubyClass superClazz, ObjectAllocator allocator) defineOrGetModuleUnder(String name) this method should be used only by interpreter or compilerdeleteClassVariable(String name) deleteConstant(String name) deprecate_constant(ThreadContext context, IRubyObject name) deprecate_constant(ThreadContext context, IRubyObject[] names) voiddeprecateConstant(Ruby runtime, String name) private voiddoIncludeModule(RubyModule baseModule) Include the given module and all related modules into the hierarchy above this module/class.private voiddoPrependModule(RubyModule baseModule) Prepend the given module and all related modules into the hierarchy above this module/class.protected final voidprotected final voidbooleanWe override equals here to provide a faster path, since equality for modules is pretty cut and dried.voidexportMethod(String name, Visibility visibility) rb_export_methodextend_object(IRubyObject obj) rb_mod_extend_objectextended(ThreadContext context, IRubyObject other, Block block) fastFetchClassVariable(String internedName) Deprecated.fastFetchConstant(String internedName) Deprecated.fastGetClass(String internedName) Deprecated.fastGetClassVar(String internedName) Deprecated.fastGetConstant(String internedName) Deprecated.fastGetConstant(String internedName, boolean inherit) Deprecated.fastGetConstantAt(String internedName) Deprecated.fastGetConstantFrom(String internedName) Deprecated.fastGetConstantFromConstMissing(String internedName) Deprecated.fastGetConstantFromNoConstMissing(String internedName) Deprecated.booleanfastHasClassVariable(String internedName) Deprecated.booleanfastHasConstant(String internedName) Deprecated.booleanfastIsClassVarDefined(String internedName) Deprecated.booleanfastIsConstantDefined(String internedName) Deprecated.booleanfastIsConstantDefined19(String internedName) Deprecated.booleanfastIsConstantDefined19(String internedName, boolean inherit) Deprecated.fastSetClassVar(String internedName, IRubyObject value) Deprecated.fastSetConstant(String internedName, IRubyObject value) Deprecated.fastStoreClassVariable(String internedName, IRubyObject value) Deprecated.fastStoreConstant(String internedName, IRubyObject value) Deprecated.fetchClassVariable(String name) fetchConstant(String name) fetchConstant(String name, boolean includePrivate) findImplementer(RubyModule clazz) Find the given class in this hierarchy, considering modules along the way.private static RubyModulefindRefinement(Map<RubyModule, RubyModule> refinements, RubyModule target) protected final IRubyObjectfinishAutoload(String name) Extract an Object which is defined by autoload thread from autoloadMap and define it as a constant.final IRubyObjectfreeze(ThreadContext context) rb_mod_freezeprivate List<RubyModule>gatherModules(RubyModule baseModule) Gather all modules that would be included by including the given module.private RubyClassgetAlreadyActivatedRefinementWrapper(RubyClass classWeAreRefining, RubyModule refinement) final IRubyObjectgetAutoloadConstant(String name) Get autoload constant.protected IRubyObjectgetAutoloadConstant(String name, boolean loadConstant) protected RubyStringgetAutoloadFile(String name) protected Map<String,RubyModule.Autoload> AutoloadMap must be accessed after checking ConstantMap.protected Map<String,RubyModule.Autoload> Get the base name of this class, or null if it is an anonymous class.private final Map<String,CacheEntry> private final Map<String,CacheEntry> booleanGet whether this Java proxy class should try to keep its instances idempotent and alive using the ObjectProxyCache.final intDeprecated.Finds a class that is within the current module (or class).Get the ClassIndex for this class.getClassVar(String name) Retrieve the specified class variable, searching through this module, included modules, and supermodules.getClassVar(IRubyObject nameObject, String name) protected Map<String,IRubyObject> protected Map<String,IRubyObject> private Map<String,IRubyObject> Get the class variables for write.private Map<String,IRubyObject> Get the class variables for write.getClassVarQuiet(String name) getConstant(String name) Retrieve the named constant, invoking 'const_missing' should that be appropriate.getConstant(String name, boolean inherit) getConstant(String name, boolean inherit, boolean includeObject) getConstantAt(String name) getConstantAt(String name, boolean includePrivate) getConstantAtSpecial(String name) This version searches superclasses if we're starting with Object.getConstantFrom(String name) getConstantFromNoConstMissing(String name, boolean includePrivate) getConstantNames(boolean includePrivate) getConstantNoConstMissing(String name, boolean inherit) getConstantNoConstMissing(String name, boolean inherit, boolean includeObject) final IRubyObjectDeprecated.private IRubyObjectgetConstantSkipAutoload(String name, boolean inherit, boolean includeObject) getConstantWithAutoload(String name, IRubyObject failedAutoloadValue, boolean includePrivate) Search just this class for a constant value, or trigger autoloading.private Visibilityfinal intfinal Integerfinal MethodHandlebooleanGet whether this class is associated with (i.e.Finds a module that is within the current module (or class).getName()Generate a fully-qualified class name or a #-style name for anonymous and singleton classes.This is overridden in the other concrete Java builtins to provide a fast way to determine what type they are.Deprecated.In an included or prepended module what is the ACTUAL module it represents?private RubyModuleGet the "real" module, either the current one or the nearest ancestor that is not a singleton or include wrapper.Get the "simple" name for the class, which is either the "base" name or the "anonymous" class name.Deprecated.Deprecated.Getter for property superClass.booleanhasClassVariable(String name) booleanhasConstant(String name) private booleanhasConstantInHierarchy(String name) hash()rb_obj_id Will return the hash code of this object.inthashCode()This override does not do "checked" dispatch since Object usually has #hash defined.booleanBehaves similarly togetClassVar(String).booleanbooleanbooleaninclude(IRubyObject[] modules) rb_mod_includeinclude(ThreadContext context, IRubyObject module) include_p(ThreadContext context, IRubyObject arg) included(ThreadContext context, IRubyObject other) included_modules(ThreadContext context) rb_mod_included_modulesvoidincludeModule(IRubyObject arg) Include a new module in this module or class.initialize(Block block) Deprecated.initialize(ThreadContext context, Block block) rb_mod_initializeinitialize_copy(IRubyObject original) mri: rb_mod_init_copyinstance_method(IRubyObject symbol) instance_methods(IRubyObject[] args) private RubyArrayinstance_methods(IRubyObject[] args, Visibility visibility, boolean not) Get a list of all instance methods names of the provided visibility unless not is true, then getService all methods which are not the providedinstance_methods19(IRubyObject[] args) instanceMethods(IRubyObject[] args, Visibility visibility, boolean obj, boolean not) instanceMethods(Visibility visibility, boolean includeSuper, boolean obj, boolean not) voidprotected voidDeprecated.protected voidinvalidateConstantCache(String constantName) private voidprotected voidinvalidateConstantCaches(Set<String> constantNames) protected voidbooleanisClass()Specifically polymorphic method that are meant to be overridden by classes to specify that they are classes in an easy way.booleanisClassVarDefined(String name) Is class var defined? Ruby C equivalent = "rb_cvar_defined"booleanisConstantDefined(String name) booleanisConstantDefined(String name, boolean inherit) booleanIs this module one that in an included one (e.g.booleanbooleanisInstance(IRubyObject object) booleanisKindOfModule(RubyModule type) booleanisMethodBound(String name, boolean checkVisibility) MRI: rb_method_boundpbooleanisMethodBound(String name, boolean checkVisibility, boolean checkRespondTo) Deprecated.booleanisMethodBuiltin(String methodName) Return true if the given method is defined on this class and is a builtin (defined in Java at boot).booleanisModule()Specifically polymorphic method that are meant to be overridden by modules to specify that they are modules in an easy way.booleanbooleanprivate booleanisReifiable(Ruby runtime, RubyClass superClass) Determine if a new child of the given class can have its variables reified.protected booleanisSame(RubyModule module) protected booleanisSameOrigin(RubyModule other) booleanbooleanprivate static IRubyObjectiterateConstantNoConstMissing(String name, RubyModule init, boolean inherit, boolean loadConstant) static TypePopulatorloadPopulatorFor(Class<?> type) static voidmarshalTo(RubyModule module, MarshalStream output) method_added(ThreadContext context, IRubyObject nothing) method_defined_p(ThreadContext context, IRubyObject symbol) method_defined_p(ThreadContext context, IRubyObject symbol, IRubyObject includeSuper) method_removed(ThreadContext context, IRubyObject nothing) method_undefined(ThreadContext context, IRubyObject nothing) mix(ThreadContext context, IRubyObject mod) mix(ThreadContext context, IRubyObject mod, IRubyObject hash0) module_eval(ThreadContext context, Block block) module_eval(ThreadContext context, IRubyObject[] args, Block block) Deprecated.module_eval(ThreadContext context, IRubyObject arg0, Block block) module_eval(ThreadContext context, IRubyObject arg0, IRubyObject arg1, Block block) module_eval(ThreadContext context, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, Block block) module_exec(ThreadContext context, Block block) module_exec(ThreadContext context, IRubyObject[] args, Block block) module_function(ThreadContext context, IRubyObject[] args) rb_mod_modfuncname()name(ThreadContext context) name19()Deprecated.booleanstatic RubyArraynesting(ThreadContext context, IRubyObject recv, Block block) Return an array of nested modules or classes.static Map<RubyModule,IncludedModule> protected final MethodHandlenewIncludeClass(RubyClass superClazz) Deprecated.final IRubyObjectnewMethod(IRubyObject receiver, String methodName, boolean bound, Visibility visibility) final IRubyObjectnewMethod(IRubyObject receiver, String methodName, boolean bound, Visibility visibility, boolean respondToMissing) newMethod(IRubyObject receiver, String methodName, boolean bound, Visibility visibility, boolean respondToMissing, boolean priv) static RubyModulerb_module_newstatic RubyModulenewModule(Ruby runtime, String name, RubyModule parent, boolean setParent) rb_module_new/rb_define_module_id/rb_name_class/rb_set_class_pathstatic Map<RubyModule,RubyModule> static Map<RubyModule,RubyModule> newRefinementsMap(Map<RubyModule, RubyModule> refinements) op_cmp(IRubyObject obj) rb_mod_cmpop_eqq(ThreadContext context, IRubyObject obj) rb_mod_eqqop_equal(ThreadContext context, IRubyObject other) rb_obj_equal Will by default use identity equality to compare objects.op_ge(IRubyObject obj) rb_mod_geop_gt(IRubyObject obj) rb_mod_gtop_le(IRubyObject arg) MRI: rb_class_inherited_pop_lt(IRubyObject obj) rb_mod_lt(package private) final voidpopulateInstanceMethodNames(Set<String> seen, RubyArray ary, Visibility visibility, boolean obj, boolean not, boolean recur) prepend(ThreadContext context, IRubyObject[] modules) prepend_features(IRubyObject include) rb_mod_prepend_featuresprepended(ThreadContext context, IRubyObject other) voidprependModule(RubyModule module) Prepend a new module to this module or class.voidprependModule(IRubyObject arg) Deprecated.private_class_method(IRubyObject[] args) private_constant(ThreadContext context, IRubyObject name) private_constant(ThreadContext context, IRubyObject[] rubyNames) private_instance_methods(IRubyObject[] args) rb_class_private_instance_methodsDeprecated.private_method_defined(ThreadContext context, IRubyObject symbol) private_method_defined(ThreadContext context, IRubyObject symbol, IRubyObject includeSuper) private RubyModuleproceedWithInclude(RubyModule insertAbove, RubyModule moduleToInclude) Actually proceed with including the specified module above the given target in a hierarchy.private RubyModuleproceedWithPrepend(RubyModule insertBelow, RubyModule moduleToPrepend) Actually proceed with prepending the specified module below the given target in a hierarchy.rb_class_protected_instance_methodsDeprecated.protected_method_defined(ThreadContext context, IRubyObject symbol) protected_method_defined(ThreadContext context, IRubyObject symbol, IRubyObject includeSuper) public_class_method(IRubyObject[] args) public_constant(ThreadContext context, IRubyObject name) public_constant(ThreadContext context, IRubyObject[] rubyNames) public_instance_method(IRubyObject symbol) public_instance_methods(IRubyObject[] args) public_instance_methods19(IRubyObject[] args) public_method_defined(ThreadContext context, IRubyObject symbol) public_method_defined(ThreadContext context, IRubyObject symbol, IRubyObject includeSuper) booleanpublicConstDefinedFrom(String name) voidputAlias(String id, DynamicMethod method, String oldName) voidputAlias(String id, CacheEntry entry, String oldName) Alias the method contained in the given CacheEntry as a new entry in this module.putMethod(Ruby runtime, String id, DynamicMethod method) rbPrivate(ThreadContext context, IRubyObject[] args) rb_mod_privaterbProtected(ThreadContext context, IRubyObject[] args) rb_mod_protectedrbPublic(ThreadContext context, IRubyObject[] args) rb_mod_publicrefine(ThreadContext context, IRubyObject klass, Block block) private CacheEntryrefinedMethodOriginalMethodEntry(Map<RubyModule, RubyModule> refinements, String id, boolean cacheUndef, CacheEntry entry) private static RubyClassrefinementSuperclass(Ruby runtime, RubyModule superClass) remove_class_variable(ThreadContext context, IRubyObject name) rb_mod_remove_cvarremove_class_variable19(ThreadContext context, IRubyObject name) remove_const(ThreadContext context, IRubyObject rubyName) remove_method(ThreadContext context, IRubyObject[] args) private voidremoveAutoload(String name) Removes an Autoload object from autoloadMap.final voidremoveClassProvider(ClassProvider provider) removeClassVariable(String name) voidremoveMethod(ThreadContext context, String id) resolveRefinedMethod(Map<RubyModule, RubyModule> refinements, CacheEntry entry, String id, boolean cacheUndef) final IRubyObjectresolveUndefConstant(String name) booleanrespondsToMethod(String name, boolean checkVisibility) booleanrespondsToMethod(String name, boolean checkVisibility, StaticScope scope) retrieveMethod(String name) Search through this module and supermodules for method definitions.rubyName()Generate a fully-qualified class name or a #-style name for anonymous and singleton classes which is properly encoded.protected RubyModuleprivate CacheEntrysearchForAliasMethod(Ruby runtime, String id) Behaves similarly togetClassVar(String).final DynamicMethodsearchMethod(String name) Search through this module and supermodules for method definitions.protected DynamicMethodSearches for a method up until the superclass, but include modules.private RubyClasssearchProvidersForClass(String name, RubyClass superClazz) private RubyModulesearchWithCache(String name) Search for the named method in this class and in superclasses, and if found return the CacheEntry representing the method and this class's serial number.final CacheEntrysearchWithCache(String id, boolean cacheUndef) Search through this module and supermodules for method definitions.private final CacheEntrysearchWithCacheAndRefinements(String id, boolean cacheUndef, StaticScope refinedScope) private CacheEntrysearchWithCacheMiss(Ruby runtime, String id, boolean cacheUndef) Search through this module and supermodules for method definitions aftercacheHit(String)failed to return a result.searchWithRefinements(String name, StaticScope refinedScope) Search for the named method in this class and in superclasses applying refinements from the given scope.private booleansetAutoloadConstant(String name, IRubyObject value) Set an Object as a defined constant in autoloading.voidsetBaseName(String name) Set the base name of the class.voidsetCacheProxy(boolean cacheProxy) Set whether this Java proxy class should try to keep its instances idempotent and alive using the ObjectProxyCache.(package private) voidsetClassIndex(ClassIndex classIndex) Set the ClassIndex for this core class.setClassVar(String name, IRubyObject value) Set the named class variable to the given value, provided taint and freeze allow setting it.setConstant(String name, IRubyObject value) Set the named constant on this module.setConstant(String name, IRubyObject value, boolean hidden) private IRubyObjectsetConstantCommon(String name, IRubyObject value, boolean hidden, boolean warn) Set the named constant on this module.setConstantQuiet(String name, IRubyObject value) Set the named constant on this module.final voidsetConstantVisibility(Ruby runtime, String name, boolean hidden) voidsetInternalModuleVariable(String name, IRubyObject value) Behaves similarly tosetClassVar(String, IRubyObject).voidsetJavaProxy(boolean javaProxy) Set whether this class is associated with (i.e.voidsetMethodLocation(RubyModule module) voidsetMethodVisibility(IRubyObject[] methods, Visibility visibility) set_method_visibilityvoidsetParent(RubyModule parent) private voidsetParentForModule(String name, IRubyObject value) voidsetRefinements(Map<RubyModule, RubyModule> refinements) voidsetSuperClass(RubyClass superClass) private voidsetVisibility(ThreadContext context, IRubyObject[] args, Visibility visibility) singleton_class_p(ThreadContext context) storeClassVariable(String name, IRubyObject value) storeConstant(String name, IRubyObject value) storeConstant(String name, IRubyObject value, boolean hidden) private IRubyObjectstoreConstant(String name, IRubyObject value, boolean hidden, boolean deprecated) voidsyncClassVariables(RubyModule other) voidsyncConstants(RubyModule other) to_s()rb_mod_to_s<T> TConvert the object to the specified Java class, if possible.voidundef(ThreadContext context, String name) rb_undefundef_method(ThreadContext context, IRubyObject[] args) static StringundefinedMethodMessage(Ruby runtime, IRubyObject name, IRubyObject modName, boolean isModule) voidundefineMethod(String name) static RubyModuleunmarshalFrom(UnmarshalStream input) voidprivate voidupdateGeneration(Ruby runtime) used_modules(ThreadContext context) using(ThreadContext context, IRubyObject refinedModule) static voidusingModule(ThreadContext context, RubyModule cref, IRubyObject refinedModule) private static voidusingModuleRecursive(RubyModule cref, RubyModule module) private static voidusingRefinement(Ruby runtime, RubyModule cref, RubyModule klass, RubyModule module) protected final StringvalidateClassVariable(String name) protected StringvalidateClassVariable(Ruby runtime, IRubyObject object) protected final StringvalidateClassVariable(IRubyObject nameObj, String name) protected final StringvalidateConstant(String name, IRubyObject errorName) protected final StringvalidateConstant(IRubyObject name) Validates name is a valid constant name and returns its id string.private static voidwarnMethodRemoval(ThreadContext context, String id) private voidyieldRefineBlock(ThreadContext context, RubyModule refinement, Block block) Methods inherited from class org.jruby.RubyObject
attachToObjectSpace, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, convertToType, createObjectClass, dig, dig1, dig2, eqlInternal, equalInternal, inspect, puts, specificEval, toRubyString, toStringMethods inherited from class org.jruby.RubyBasicObject
addFinalizer, anyToString, asJavaString, asString, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callSuper, checkArrayType, checkCallMethod, checkCallMethod, checkStringType, checkStringType19, compareTo, convertToArray, convertToFloat, convertToHash, convertToInteger, convertToInteger, convertToInteger, convertToString, copyInstanceVariablesInto, copySpecialInstanceVariables, createBasicObjectClass, dataGetStruct, dataGetStructChecked, dataWrapStruct, decode, defaultToJava, display, dup, ensureInstanceVariablesSettable, eql, eql_p, equal_p, equal_p19, evalUnder, extend, fastGetInstanceVariable, fastGetInternalVariable, fastHasInstanceVariable, fastHasInternalVariable, fastSetInstanceVariable, fastSetInternalVariable, frozen_p, getFFIHandle, getFlag, getInstanceEvalClass, getInstanceVariable, getInstanceVariableList, getInstanceVariableNameList, getInstanceVariables, getInternalVariable, getInternalVariables, getJavaClass, getMetaClass, getMetaClass, getNativeHandle, getNativeTypeIndex, getObjectId, getRuntime, getSingletonClass, getSingletonClassClone, getSingletonClassCloneAndAttach, getType, getVariable, getVariableCount, getVariableList, getVariableNameList, hashyInspect, hasInstanceVariable, hasInstanceVariables, hasInternalVariable, hasVariables, id, infectBy, infectBy, infectBy, initialize, initialize19, inspect, inspectHashCode, instance_eval, instance_eval, instance_eval, instance_eval, instance_eval19, instance_eval19, instance_eval19, instance_eval19, instance_exec, instance_exec19, instance_of_p, instance_variable_defined_p, instance_variable_get, instance_variable_set, instance_variables, instance_variables19, isBuiltin, isFalse, isFrozen, isImmediate, isNil, isSpecialConst, isSpecialObject, isTaint, isTrue, isUntrusted, kind_of_p, makeMetaClass, method, method_missing, method_missing19, method19, methods, methods, methods19, methodsImpl, nil_p, nonFixnumHashCode, OBJ_INIT_COPY, objInitCopy, op_cmp, op_equal_19, op_match, op_match19, op_not, op_not_equal, op_not_match, private_methods, private_methods19, protected_methods, protected_methods19, public_methods, public_methods19, rbClone, rbClone, rbInspect, recacheBuiltinMethods, remove_instance_variable, removeFinalizers, removeInstanceVariable, removeInternalVariable, respond_to_p, respond_to_p, respond_to_p, respond_to_p19, respond_to_p19, respondsTo, respondsToMissing, respondsToMissing, send, send, send, send, send, send19, send19, send19, send19, setFFIHandle, setFlag, setFrozen, setInstanceVariable, setInternalVariable, setMetaClass, setNativeHandle, setTaint, setUntrusted, setVariable, singleton_method, singleton_method_added, singleton_method_added19, singleton_method_removed, singleton_method_removed19, singleton_method_undefined, singleton_method_undefined19, singleton_methods, specificEval, specificEval, specificEval, specificEval, syncVariables, syncVariables, taint, taint, tainted, tainted_p, testFrozen, testFrozen, to_a, to_a, trust, type, type_deprecated, untaint, untrust, untrusted_p, validateInstanceVariable, validateInstanceVariable, validateInstanceVariable, variableTableContains, variableTableFastContains, variableTableFastFetch, variableTableFastStore, variableTableFetch, variableTableRemove, variableTableStore, variableTableSync, yieldUnder, yieldUnder
-
Field Details
-
LOG
-
CACHEPROXY_F
public static final int CACHEPROXY_F -
NEEDSIMPL_F
public static final int NEEDSIMPL_F -
REFINED_MODULE_F
public static final int REFINED_MODULE_F -
IS_OVERLAID_F
public static final int IS_OVERLAID_F -
OMOD_SHARED
public static final int OMOD_SHARED -
INCLUDED_INTO_REFINEMENT
public static final int INCLUDED_INTO_REFINEMENT -
MODULE_ALLOCATOR
-
NormalCacheEntryFactory
-
cacheEntryFactory
-
kindOf
-
id
public final int id -
idTest
Pre-built test that takes ThreadContext, IRubyObject and checks that the object is a module with the same ID as this one. -
parent
The class/module within whose namespace this class/module resides. -
baseName
The base name of this class/module, excluding nesting. If null, this is an anonymous class. -
cachedName
The cached name, full class name e.g. Foo::Bar if this class and all containing classes are non-anonymous. The cached anonymous class name never changes and has a nonzero cost to calculate. -
cachedRubyName
-
constants
-
autoloads
-
methods
-
cachedMethods
-
generation
protected int generation -
generationObject
-
includingHierarchies
-
methodLocation
Where are the methods of this module/class located? This only happens as a result of prepend (see PrependedModule) where it moves all methods to a PrependedModule which will be beneath the actual module which was prepended. -
classProviders
-
superClass
-
index
Deprecated.use RubyModule#getClassIndex()The index of this class in the ClassIndex. Only non-zero for native JRuby classes that have a corresponding entry in ClassIndex.- See Also:
-
SCOPE_CAPTURING_METHODS
Deprecated. -
classIndex
-
classVariables
-
refinements
Refinements added to this module are stored here -
activatedRefinements
A list of refinement hosts for this refinement -
refinedClass
The class this refinement refines -
definedAt
The module where this refinement was defined -
CLASSVARS_UPDATER
-
methodInvalidator
-
javaProxy
private boolean javaProxyWhether this class proxies a normal Java class -
LOOKUP
-
testModuleMatch
A handle for invoking the module ID test, to be reused for all idTest handles below.
-
-
Constructor Details
-
RubyModule
separate path for MetaClass construction -
RubyModule
used by MODULE_ALLOCATOR and RubyClass constructors -
RubyModule
standard path for Module construction
-
-
Method Details
-
createModuleClass
-
checkValidBindTargetFrom
public void checkValidBindTargetFrom(ThreadContext context, RubyModule originModule, boolean fromBind) throws RaiseException - Throws:
RaiseException
-
getClassIndex
Get the ClassIndex for this class. Will be NO_CLASS for non-core types. -
setClassIndex
Set the ClassIndex for this core class. Only used at boot time for core types.- Parameters:
classIndex- the ClassIndex for this type
-
autoload
-
autoload_p
-
getNativeClassIndex
Description copied from class:RubyObjectThis is overridden in the other concrete Java builtins to provide a fast way to determine what type they are. Will generally return a value from org.jruby.runtime.ClassIndex- Specified by:
getNativeClassIndexin interfaceCoreObjectType- Overrides:
getNativeClassIndexin classRubyObject- See Also:
-
isModule
public boolean isModule()Description copied from class:RubyBasicObjectSpecifically polymorphic method that are meant to be overridden by modules to specify that they are modules in an easy way.- Specified by:
isModulein interfaceIRubyObject- Overrides:
isModulein classRubyBasicObject- 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
public boolean isClass()Description copied from class:RubyBasicObjectSpecifically polymorphic method that are meant to be overridden by classes to specify that they are classes in an easy way.- Specified by:
isClassin interfaceIRubyObject- Overrides:
isClassin classRubyBasicObject- 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.
-
isSingleton
public boolean isSingleton() -
isInstance
-
getConstantMap
-
getConstantMapForWrite
-
getAutoloadMap
AutoloadMap must be accessed after checking ConstantMap. Checking UNDEF value in constantMap works as a guard. For looking up constant, check constantMap first then try to get an Autoload object from autoloadMap. For setting constant, update constantMap first and remove an Autoload object from autoloadMap. -
getAutoloadMapForWrite
-
addIncludingHierarchy
-
getIdTest
-
newIdTest
-
needsImplementer
public boolean needsImplementer() -
newModule
rb_module_new -
newModule
rb_module_new/rb_define_module_id/rb_name_class/rb_set_class_path -
addClassProvider
-
removeClassProvider
-
checkForCyclicInclude
- Throws:
RaiseException
-
checkForCyclicPrepend
- Throws:
RaiseException
-
searchProvidersForClass
-
searchProvidersForModule
-
getSuperClass
Getter for property superClass.- Returns:
- Value of property superClass.
-
setSuperClass
-
getParent
-
setParent
-
getMethodLocation
-
setMethodLocation
-
getMethods
-
getMethodsForWrite
-
putMethod
- Parameters:
runtime-id- identifier string (8859_1). Matching entry in symbol table.method-- Returns:
- method
-
isIncluded
public boolean isIncluded()Is this module one that in an included one (e.g. anIncludedModuleWrapper).- See Also:
-
isPrepended
public boolean isPrepended() -
getOrigin
In an included or prepended module what is the ACTUAL module it represents?- Returns:
- the actual module of an included/prepended module.
-
getNonIncludedClass
Deprecated. -
getDelegate
-
getRealModule
Get the "real" module, either the current one or the nearest ancestor that is not a singleton or include wrapper. SeeRubyClass.getRealClass().- Returns:
- the nearest non-singleton non-include module in the hierarchy
-
getBaseName
Get the base name of this class, or null if it is an anonymous class.- Returns:
- base name of the class
-
setBaseName
Set the base name of the class. If null, the class effectively becomes anonymous (though constants elsewhere may reference it).- Parameters:
name- the new base name of the class
-
getName
Generate a fully-qualified class name or a #-style name for anonymous and singleton classes. Ruby C equivalent = "classname"- Returns:
- The generated class name
-
rubyName
Generate a fully-qualified class name or a #-style name for anonymous and singleton classes which is properly encoded. The returned string is always frozen.- Returns:
- a properly encoded class name. Note: getId() is only really valid for ASCII values. This should be favored over using it.
-
rubyBaseName
-
calculateAnonymousRubyName
-
calculateRubyName
-
getSimpleName
Get the "simple" name for the class, which is either the "base" name or the "anonymous" class name.- Returns:
- the "simple" name of the class
-
calculateName
Recalculate the fully-qualified name of this class/module. -
calculateAnonymousName
-
refine
-
createNewRefinedModule
-
refinementSuperclass
-
yieldRefineBlock
-
getAlreadyActivatedRefinementWrapper
private RubyClass getAlreadyActivatedRefinementWrapper(RubyClass classWeAreRefining, RubyModule refinement) -
addActivatedRefinement
private void addActivatedRefinement(ThreadContext context, RubyModule moduleToRefine, RubyModule refinement) -
using
-
usingModule
-
usingModuleRecursive
-
usingRefinement
private static void usingRefinement(Ruby runtime, RubyModule cref, RubyModule klass, RubyModule module) -
newRefinementsMap
-
newRefinementsMap
-
newActivatedRefinementsMap
-
used_modules
-
newIncludeClass
Deprecated.Create a wrapper to use for including the specified module into this one. Ruby C equivalent = "include_class_new"- Returns:
- The module wrapper
-
getModule
Finds a module that is within the current module (or class).- Parameters:
name- to be found in this module (or class)- Returns:
- the module or null if no such module
- Since:
- 9.2
-
getClass
Finds a class that is within the current module (or class).- Parameters:
name- to be found in this module (or class)- Returns:
- the class or null if no such class
-
fastGetClass
Deprecated. -
prependModule
Prepend a new module to this module or class. MRI: rb_prepend_module- Parameters:
module- The module to include
-
prependModule
Deprecated. -
includeModule
Include a new module in this module or class.- Parameters:
arg- The module to include
-
defineAnnotatedMethod
-
defineAnnotatedConstants
-
defineAnnotatedConstant
-
defineAnnotatedMethods
-
loadPopulatorFor
-
defineAnnotatedMethodsIndividually
-
defineAnnotatedMethod
public final boolean defineAnnotatedMethod(String name, List<JavaMethodDescriptor> methods, MethodFactory methodFactory) -
defineAnnotatedMethod
-
defineAnnotatedMethod
public final boolean defineAnnotatedMethod(String name, JavaMethodDescriptor desc, MethodFactory methodFactory) -
undefineMethod
-
undef
rb_undef -
include_p
-
singleton_class_p
-
addMethod
-
addRefinedMethodEntry
-
addMethodInternal
-
addMethodAtBootTimeOnly
Deprecated.No longer used, internal API!This method is not intended for use by normal users; it is a fast-path method that skips synchronization and hierarchy invalidation to speed boot-time method definition.- Parameters:
id- The name to which to bind the methodmethod- The method to bind
-
removeMethod
-
warnMethodRemoval
-
searchMethod
Search through this module and supermodules for method definitions. Cache superclass definitions in this class.- Parameters:
name- The name of the method to search for- Returns:
- The method, or UndefinedMethod if not found
-
searchWithCache
Search for the named method in this class and in superclasses, and if found return the CacheEntry representing the method and this class's serial number. MRI: method_entry_get- Parameters:
name- the method name- Returns:
- the CacheEntry corresponding to the method and this class's serial number
-
searchWithRefinements
Search for the named method in this class and in superclasses applying refinements from the given scope. If found return the method; otherwise, return UndefinedMethod.- Parameters:
name- the method namerefinedScope- the scope containing refinements to search- Returns:
- the method or UndefinedMethod
-
searchWithCache
Search through this module and supermodules for method definitions. Cache superclass definitions in this class. MRI: method_entry_get- Parameters:
id- The name of the method to search forcacheUndef- Flag for caching UndefinedMethod. This should normally be true.- Returns:
- The method, or UndefinedMethod if not found
-
searchWithCacheAndRefinements
private final CacheEntry searchWithCacheAndRefinements(String id, boolean cacheUndef, StaticScope refinedScope) -
refinedMethodOriginalMethodEntry
private CacheEntry refinedMethodOriginalMethodEntry(Map<RubyModule, RubyModule> refinements, String id, boolean cacheUndef, CacheEntry entry) -
searchWithCacheMiss
Search through this module and supermodules for method definitions aftercacheHit(String)failed to return a result. Cache superclass definitions in this class. MRI: method_entry_get_without_cache- Parameters:
id- The name of the method to search forcacheUndef- Flag for caching UndefinedMethod. This should normally be true.- Returns:
- The method, or UndefinedMethod if not found
-
getCacheToken
Deprecated. -
getGeneration
public final int getGeneration() -
getGenerationObject
-
getCachedMethods
-
getCachedMethodsForWrite
-
cacheHit
-
invalidateConstantCacheForModuleInclusion
-
becomeSynchronized
public void becomeSynchronized() -
isSynchronized
public boolean isSynchronized() -
addToCache
protected CacheEntry addToCache(String id, DynamicMethod method, RubyModule sourceModule, int token) -
addToCache
-
searchMethodInner
-
searchMethodEntryInner
-
searchMethodLateral
Searches for a method up until the superclass, but include modules. This is for Concrete java ctor initialization TODO: add a cache? -
resolveRefinedMethod
public CacheEntry resolveRefinedMethod(Map<RubyModule, RubyModule> refinements, CacheEntry entry, String id, boolean cacheUndef) -
findRefinement
-
searchMethodCommon
-
invalidateCacheDescendants
public void invalidateCacheDescendants() -
invalidateCoreClasses
protected void invalidateCoreClasses() -
getInvalidator
-
updateGeneration
public void updateGeneration() -
updateGeneration
-
invalidateCacheDescendantsInner
Deprecated. -
invalidateConstantCache
-
invalidateConstantCaches
-
retrieveMethod
Search through this module and supermodules for method definitions. Cache superclass definitions in this class.- Parameters:
name- The name of the method to search for- Returns:
- The method, or UndefinedMethod if not found
-
findImplementer
Find the given class in this hierarchy, considering modules along the way.- Parameters:
clazz- the class to find- Returns:
- The method, or UndefinedMethod if not found
-
addModuleFunction
-
defineAlias
rb_alias -
putAlias
- Parameters:
id-method-oldName-
-
putAlias
Alias the method contained in the given CacheEntry as a new entry in this module.- Parameters:
id-entry-oldName-
-
searchForAliasMethod
-
checkAliasFrameAccesses
-
defineOrGetClassUnder
this method should be used only by interpreter or compiler -
defineOrGetClassUnder
public RubyClass defineOrGetClassUnder(String name, RubyClass superClazz, ObjectAllocator allocator) -
isReifiable
Determine if a new child of the given class can have its variables reified. -
defineOrGetModuleUnder
this method should be used only by interpreter or compiler -
defineClassUnder
rb_define_class_under this method should be used only as an API to define/open nested classes -
defineModuleUnder
rb_define_module_under this method should be used only as an API to define/open nested module -
addAccessor
private void addAccessor(ThreadContext context, RubySymbol identifier, Visibility visibility, boolean readable, boolean writeable) -
setMethodVisibility
set_method_visibility -
exportMethod
rb_export_method -
deepMethodSearch
-
undefinedMethodMessage
public static String undefinedMethodMessage(Ruby runtime, IRubyObject name, IRubyObject modName, boolean isModule) -
isMethodBound
MRI: rb_method_boundp -
respondsToMethod
-
respondsToMethod
-
isMethodBound
@Deprecated public boolean isMethodBound(String name, boolean checkVisibility, boolean checkRespondTo) Deprecated. -
newMethod
public final IRubyObject newMethod(IRubyObject receiver, String methodName, boolean bound, Visibility visibility) -
newMethod
public final IRubyObject newMethod(IRubyObject receiver, String methodName, boolean bound, Visibility visibility, boolean respondToMissing) -
newMethod
public IRubyObject newMethod(IRubyObject receiver, String methodName, boolean bound, Visibility visibility, boolean respondToMissing, boolean priv) -
define_method
-
getCurrentVisibilityForDefineMethod
-
defineMethodFromBlock
public IRubyObject defineMethodFromBlock(ThreadContext context, IRubyObject arg0, Block block, Visibility visibility) -
define_method
public IRubyObject define_method(ThreadContext context, IRubyObject arg0, IRubyObject arg1, Block block) -
defineMethodFromCallable
public IRubyObject defineMethodFromCallable(ThreadContext context, IRubyObject arg0, IRubyObject arg1, Visibility visibility) -
define_method
@Deprecated public IRubyObject define_method(ThreadContext context, IRubyObject[] args, Block block) Deprecated. -
createProcMethod
private DynamicMethod createProcMethod(Ruby runtime, String name, Visibility visibility, Block block) -
name
-
name
-
name19
Deprecated. -
cloneMethods
-
initialize_copy
mri: rb_mod_init_copy- Overrides:
initialize_copyin classRubyBasicObject
-
checkSafeTypeToCopy
-
syncConstants
-
syncClassVariables
-
included_modules
rb_mod_included_modules -
hasPrepends
public boolean hasPrepends() -
ancestors
rb_mod_ancestors -
ancestors
Deprecated. -
getAncestorList
-
hasModuleInPrepends
-
getPrependCeiling
-
hasModuleInHierarchy
-
hashCode
public int hashCode()Description copied from class:RubyObjectThis override does not do "checked" dispatch since Object usually has #hash defined.- Overrides:
hashCodein classRubyObject- See Also:
-
hash
Description copied from class:RubyBasicObjectrb_obj_id 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.- Overrides:
hashin classRubyBasicObject
-
to_s
rb_mod_to_s- Overrides:
to_sin classRubyBasicObject
-
op_eqq
rb_mod_eqq- Specified by:
op_eqqin interfaceIRubyObject- Overrides:
op_eqqin classRubyObject
-
equals
We override equals here to provide a faster path, since equality for modules is pretty cut and dried.- Overrides:
equalsin classRubyObject- Parameters:
other- The object to check for equality- Returns:
- true if reference equality, false otherwise
- See Also:
-
op_equal
Description copied from class:RubyBasicObjectrb_obj_equal Will by default use identity equality to compare objects. This follows the Ruby semantics. The name of this method doesn't follow the convention because hierarchy problems- Specified by:
op_equalin interfaceIRubyObject- Overrides:
op_equalin classRubyBasicObject
-
freeze
rb_mod_freeze- Overrides:
freezein classRubyBasicObject
-
op_le
MRI: rb_class_inherited_p -
searchAncestor
-
op_lt
rb_mod_lt -
op_ge
rb_mod_ge -
op_gt
rb_mod_gt -
op_cmp
rb_mod_cmp -
isKindOfModule
-
isSame
-
isSameOrigin
-
initialize
rb_mod_initialize -
addReadWriteAttribute
-
addReadAttribute
-
addWriteAttribute
-
attr
rb_mod_attr -
attr19
Deprecated. -
attr_reader
Deprecated. -
attr_reader
rb_mod_attr_reader -
attr_writer
rb_mod_attr_writer -
attr_accessor
Deprecated. -
attr_accessor
rb_mod_attr_accessor Note: this method should not be called from Java in most cases, since it depends on Ruby frame state for visibility. Use add[Read/Write]Attribute instead. -
instance_methods
Get a list of all instance methods names of the provided visibility unless not is true, then getService all methods which are not the provided- Parameters:
args- passed into one of the Ruby instance_method methodsvisibility- to find matching instance methods againstnot- if true only find methods not matching supplied visibility- Returns:
- a RubyArray of instance method names
-
instanceMethods
public RubyArray instanceMethods(IRubyObject[] args, Visibility visibility, boolean obj, boolean not) -
instanceMethods
public RubyArray instanceMethods(Visibility visibility, boolean includeSuper, boolean obj, boolean not) -
populateInstanceMethodNames
final void populateInstanceMethodNames(Set<String> seen, RubyArray ary, Visibility visibility, boolean obj, boolean not, boolean recur) -
addMethodSymbols
protected void addMethodSymbols(Ruby runtime, Set<String> seen, RubyArray ary, boolean not, Visibility visibility) -
instance_methods
-
instance_methods19
-
public_instance_methods
-
public_instance_methods19
-
instance_method
-
public_instance_method
-
protected_instance_methods
rb_class_protected_instance_methods -
protected_instance_methods19
Deprecated. -
private_instance_methods
rb_class_private_instance_methods -
private_instance_methods19
Deprecated. -
prepend_features
rb_mod_prepend_features -
append_features
rb_mod_append_features -
extend_object
rb_mod_extend_object -
include
rb_mod_include -
include
-
included
-
extended
-
mix
-
mix
-
setVisibility
-
rbPublic
rb_mod_public -
rbProtected
rb_mod_protected -
rbPrivate
rb_mod_private -
module_function
rb_mod_modfunc -
method_added
-
method_removed
-
method_undefined
-
method_defined_p
-
method_defined_p
public RubyBoolean method_defined_p(ThreadContext context, IRubyObject symbol, IRubyObject includeSuper) -
public_method_defined
-
public_method_defined
public IRubyObject public_method_defined(ThreadContext context, IRubyObject symbol, IRubyObject includeSuper) -
protected_method_defined
-
protected_method_defined
public IRubyObject protected_method_defined(ThreadContext context, IRubyObject symbol, IRubyObject includeSuper) -
private_method_defined
-
private_method_defined
public IRubyObject private_method_defined(ThreadContext context, IRubyObject symbol, IRubyObject includeSuper) -
checkMethodVisibility
private Visibility checkMethodVisibility(ThreadContext context, IRubyObject symbol, boolean parents) -
public_class_method
-
private_class_method
-
alias_method
-
undef_method
-
module_eval
-
module_eval
-
module_eval
public IRubyObject module_eval(ThreadContext context, IRubyObject arg0, IRubyObject arg1, Block block) -
module_eval
public IRubyObject module_eval(ThreadContext context, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, Block block) -
module_eval
Deprecated. -
module_exec
-
module_exec
-
remove_method
-
marshalTo
- Throws:
IOException
-
unmarshalFrom
- Throws:
IOException
-
nesting
Return an array of nested modules or classes. -
doIncludeModule
Include the given module and all related modules into the hierarchy above this module/class. Inspects the hierarchy to ensure the same module isn't included twice, and selects an appropriate insertion point for each incoming module.- Parameters:
baseModule- The module to include, along with any modules it itself includes
-
doPrependModule
Prepend the given module and all related modules into the hierarchy above this module/class. Inspects the hierarchy to ensure the same module isn't included twice, and selects an appropriate insertion point for each incoming module.- Parameters:
baseModule- The module to prepend, along with any modules it itself includes
-
gatherModules
Gather all modules that would be included by including the given module. The resulting list contains the given module and its (zero or more) module-wrapping superclasses.- Parameters:
baseModule- The base module from which to aggregate modules- Returns:
- A list of all modules that would be included by including the given module
-
proceedWithInclude
Actually proceed with including the specified module above the given target in a hierarchy. Return the new module wrapper.- Parameters:
insertAbove- The hierarchy target above which to include the wrapped modulemoduleToInclude- The module to wrap and include- Returns:
- The new module wrapper resulting from this include
-
proceedWithPrepend
Actually proceed with prepending the specified module below the given target in a hierarchy. Return the new module wrapper.- Parameters:
insertBelow- The hierarchy target below which to include the wrapped modulemoduleToPrepend- The module to wrap and prepend- Returns:
- The new module wrapper resulting from this prepend
-
class_variable_defined_p
-
class_variable_get
rb_mod_cvar_get -
class_variable_get19
-
class_variable_set
rb_mod_cvar_set -
class_variable_set19
-
remove_class_variable
rb_mod_remove_cvar -
remove_class_variable19
-
class_variables19
Deprecated. -
class_variables
-
class_variables
-
classVariablesCommon
-
const_defined_p
rb_mod_const_defined -
const_defined_p
-
constDefined
-
const_get
-
const_get_1_9
Deprecated. -
const_get_2_0
Deprecated. -
const_get
rb_mod_const_get -
const_set
rb_mod_const_set -
remove_const
-
hasConstantInHierarchy
-
const_missing
Base implementation of Module#const_missing, throws NameError for specific missing constant.- Parameters:
rubyName- The constant name which was found to be missing- Returns:
- Nothing! Absolutely nothing! (though subclasses might choose to return something)
-
constants
-
constants
-
constants19
Deprecated. -
constants19
Deprecated. -
constantsCommon19
@Deprecated public RubyArray constantsCommon19(ThreadContext context, boolean replaceModule, boolean allConstants) Deprecated. -
constantsCommon
private RubyArray constantsCommon(ThreadContext context, boolean replaceModule, boolean allConstants) -
constantsCommon
public Collection<String> constantsCommon(Ruby runtime, boolean replaceModule, boolean allConstants) rb_mod_constants -
constantsCommon
public Collection<String> constantsCommon(Ruby runtime, boolean replaceModule, boolean allConstants, boolean includePrivate) -
deprecateConstant
-
deprecate_constant
-
deprecate_constant
-
private_constant
-
private_constant
-
public_constant
-
public_constant
-
prepend
-
prepended
-
setConstantVisibility
-
setClassVar
Set the named class variable to the given value, provided taint and freeze allow setting it. Ruby C equivalent = "rb_cvar_set"- Parameters:
name- The variable name to setvalue- The value to set it to
-
fastSetClassVar
Deprecated. -
getClassVar
Retrieve the specified class variable, searching through this module, included modules, and supermodules. Ruby C equivalent = "rb_cvar_get"- Parameters:
name- The name of the variable to retrieve- Returns:
- The variable's value, or throws NameError if not found
-
getClassVar
-
getClassVarQuiet
-
fastGetClassVar
Deprecated. -
isClassVarDefined
Is class var defined? Ruby C equivalent = "rb_cvar_defined"- Parameters:
name- The class var to determine "is defined?"- Returns:
- true if true, false if false
-
fastIsClassVarDefined
Deprecated. -
removeClassVariable
-
getConstantAtSpecial
This version searches superclasses if we're starting with Object. This corresponds to logic in rb_const_defined_0 that recurses for Object only.- Parameters:
name- the constant name to find- Returns:
- the constant, or null if it was not found
-
getConstantAt
-
getConstantAt
-
fastGetConstantAt
Deprecated. -
getConstant
Retrieve the named constant, invoking 'const_missing' should that be appropriate.- Parameters:
name- The constant to retrieve- Returns:
- The value for the constant, or null if not found
-
getConstant
-
getConstant
-
fastGetConstant
Deprecated. -
fastGetConstant
Deprecated. -
getConstantNoConstMissing
-
getConstantNoConstMissing
-
getConstantNoConstMissing
-
getConstantNoConstMissingSkipAutoload
-
getConstantNoConstMissingSKipAutoload
Deprecated. -
getConstantSkipAutoload
-
iterateConstantNoConstMissing
private static IRubyObject iterateConstantNoConstMissing(String name, RubyModule init, boolean inherit, boolean loadConstant) -
getConstantFrom
-
getConstantWithAutoload
public IRubyObject getConstantWithAutoload(String name, IRubyObject failedAutoloadValue, boolean includePrivate) Search just this class for a constant value, or trigger autoloading.- Parameters:
name-- Returns:
-
fastGetConstantFrom
Deprecated. -
getConstantFromNoConstMissing
-
getConstantFromNoConstMissing
-
fastGetConstantFromNoConstMissing
Deprecated. -
getConstantFromConstMissing
-
fastGetConstantFromConstMissing
Deprecated. -
resolveUndefConstant
-
setConstantQuiet
Set the named constant on this module. Also, if the value provided is another Module and that module has not yet been named, assign it the specified name. This version does not warn if the constant has already been set.- Parameters:
name- The name to assignvalue- The value to assign to it; if an unnamed Module, also set its basename to name- Returns:
- The result of setting the variable.
-
setConstant
Set the named constant on this module. Also, if the value provided is another Module and that module has not yet been named, assign it the specified name.- Parameters:
name- The name to assignvalue- The value to assign to it; if an unnamed Module, also set its basename to name- Returns:
- The result of setting the variable.
-
setConstant
-
setConstantCommon
Set the named constant on this module. Also, if the value provided is another Module and that module has not yet been named, assign it the specified name.- Parameters:
name- The name to assignvalue- The value to assign to it; if an unnamed Module, also set its basename to name- Returns:
- The result of setting the variable.
-
setParentForModule
-
fastSetConstant
Deprecated. -
defineConstant
rb_define_const -
isConstantDefined
-
constDefined
-
constDefinedAt
-
constDefinedFrom
-
publicConstDefinedFrom
-
constDefinedInner
private boolean constDefinedInner(String name, boolean exclude, boolean recurse, boolean visibility) rb_const_defined_0 -
autoloadingValue
-
checkAutoloadRequired
-
isConstantDefined
-
cannotRemoveError
-
hasInternalModuleVariable
Behaves similarly togetClassVar(String). Searches this class/module and its ancestors for the specified internal variable.- Parameters:
name- the internal variable name- Returns:
- the value of the specified internal variable if found, else null
- See Also:
-
searchInternalModuleVariable
Behaves similarly togetClassVar(String). Searches this class/module and its ancestors for the specified internal variable.- Parameters:
name- the internal variable name- Returns:
- the value of the specified internal variable if found, else null
- See Also:
-
setInternalModuleVariable
Behaves similarly tosetClassVar(String, IRubyObject). If the specified internal variable is found in this class/module or an ancestor, it is set where found. Otherwise it is set in this module.- Parameters:
name- the internal variable namevalue- the internal variable value- See Also:
-
getClassVariables
-
getClassVariablesForWriteSynchronized
Get the class variables for write. If it is not set or not of the right size, synchronize against the object and prepare it accordingly.- Returns:
- the class vars map, ready for assignment
-
getClassVariablesForWriteAtomic
Get the class variables for write. If it is not set or not of the right size, atomically update it with an appropriate value.- Returns:
- the class vars map, ready for assignment
-
getClassVariablesForRead
-
hasClassVariable
-
fastHasClassVariable
Deprecated. -
fetchClassVariable
-
fastFetchClassVariable
Deprecated. -
storeClassVariable
-
fastStoreClassVariable
Deprecated. -
deleteClassVariable
-
getClassVariableNameList
-
validateClassVariable
-
validateClassVariable
-
validateClassVariable
-
ensureClassVariablesSettable
protected final void ensureClassVariablesSettable() -
hasConstant
-
fastHasConstant
Deprecated. -
fetchConstant
-
fetchConstant
-
fastFetchConstant
Deprecated. -
storeConstant
-
storeConstant
-
storeConstant
private IRubyObject storeConstant(String name, IRubyObject value, boolean hidden, boolean deprecated) -
fastStoreConstant
Deprecated. -
deleteConstant
-
getStoredConstantList
Deprecated. -
getStoredConstantNameList
Deprecated. -
getConstantNames
- Returns:
- a list of constant names that exists at time this was called
-
getConstantNames
-
validateConstant
Validates name is a valid constant name and returns its id string.- Parameters:
name- object to verify as a valid constant.- Returns:
- the id for this valid constant name.
-
validateConstant
-
ensureConstantsSettable
protected final void ensureConstantsSettable() -
checkAndRaiseIfFrozen
- Throws:
RaiseException
-
checkFrozen
public final void checkFrozen()Description copied from class:RubyBasicObjectThe actual method that checks frozen with the default frozen message from MRI. If possible, call this instead ofRubyBasicObject.testFrozen(java.lang.String).- Overrides:
checkFrozenin classRubyBasicObject
-
constantTableContains
-
constantTableFetch
-
constantEntryFetch
-
constantTableStore
-
constantTableStore
-
constantTableStore
protected IRubyObject constantTableStore(String name, IRubyObject value, boolean hidden, boolean deprecated) -
constantTableRemove
-
defineAutoload
Define an autoload. ConstantMap holds UNDEF for the name as an autoload marker. -
finishAutoload
Extract an Object which is defined by autoload thread from autoloadMap and define it as a constant. -
getAutoloadConstant
Get autoload constant. If it's first resolution for the constant, it tries to require the defined feature and returns the defined value. Multi-threaded accesses are blocked and processed sequentially except if the caller is the autoloading thread. -
getAutoloadConstant
-
setAutoloadConstant
Set an Object as a defined constant in autoloading. -
removeAutoload
Removes an Autoload object from autoloadMap. ConstantMap must be updated before calling this. -
getAutoloadFile
-
define
private static void define(RubyModule module, JavaMethodDescriptor desc, String simpleName, DynamicMethod dynamicMethod) -
initialize
Deprecated. -
setJavaProxy
public void setJavaProxy(boolean javaProxy) Set whether this class is associated with (i.e. a proxy for) a normal Java class or interface. -
getJavaProxy
public boolean getJavaProxy()Get whether this class is associated with (i.e. a proxy for) a normal Java class or interface. -
getCacheProxy
public boolean getCacheProxy()Get whether this Java proxy class should try to keep its instances idempotent and alive using the ObjectProxyCache. -
setCacheProxy
public void setCacheProxy(boolean cacheProxy) Set whether this Java proxy class should try to keep its instances idempotent and alive using the ObjectProxyCache. -
toJava
Description copied from interface:IRubyObjectConvert the object to the specified Java class, if possible.- Specified by:
toJavain interfaceIRubyObject- Overrides:
toJavain classRubyBasicObject- Parameters:
target- The target type to which the object should be converted.- See Also:
-
discoverInstanceVariables
-
isRefinement
public boolean isRefinement() -
isIncludedIntoRefinement
public boolean isIncludedIntoRefinement() -
isMethodBuiltin
Return true if the given method is defined on this class and is a builtin (defined in Java at boot).- Parameters:
methodName-- Returns:
-
getRefinements
-
getRefinementsForWrite
-
setRefinements
-
fastIsConstantDefined
Deprecated. -
fastIsConstantDefined19
Deprecated. -
fastIsConstantDefined19
Deprecated. -
const_defined_p19
Deprecated. -
defineAliases
Deprecated.
-