Package org.jruby
Class PrependedModule
java.lang.Object
org.jruby.RubyBasicObject
org.jruby.RubyObject
org.jruby.RubyModule
org.jruby.RubyClass
org.jruby.PrependedModule
- All Implemented Interfaces:
Serializable,Cloneable,Comparable<IRubyObject>,InstanceVariables,InternalVariables,IRubyObject,CoreObjectType
This class is used as an intermediate superclass for Module#prepend. It takes over all
methods on the original module/class which is prepended and sets the originals methodLocation
to this class. The orignial type no longer has methods so it will look down its inheritance
chain to find them. The class which is actually prepended will be included onto the original
type. This original method holding type will be put beneath the prepend module.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.jruby.RubyClass
RubyClass.ConcreteJavaReifier, RubyClass.CS_NAMES, RubyClass.ReificatorNested classes/interfaces inherited from class org.jruby.RubyModule
RubyModule.Autoload, RubyModule.AutoloadMethod, RubyModule.CacheEntryFactory, RubyModule.ConstantEntry, RubyModule.JavaClassKindOf, RubyModule.KindOf, RubyModule.MethodClumper, RubyModule.ModuleKernelMethods, RubyModule.ProfilingCacheEntryFactory, RubyModule.RespondToMissingMethod, RubyModule.SynchronizedCacheEntryFactory, RubyModule.WrapperCacheEntryFactoryNested classes/interfaces inherited from class org.jruby.RubyObject
RubyObject.DataNested classes/interfaces inherited from class org.jruby.RubyBasicObject
RubyBasicObject.Finalizer -
Field Summary
FieldsFields inherited from class org.jruby.RubyClass
CLASS_ALLOCATOR, CS_IDX_INITIALIZE, DEFAULT_OBJECT_MARSHAL, marshal, runtimeFields inherited from class org.jruby.RubyModule
baseName, cachedMethods, CACHEPROXY_F, classIndex, generation, generationObject, id, INCLUDED_INTO_REFINEMENT, includingHierarchies, index, IS_OVERLAID_F, kindOf, methodInvalidator, methodLocation, methods, MODULE_ALLOCATOR, NEEDSIMPL_F, NormalCacheEntryFactory, OMOD_SHARED, parent, REFINED_MODULE_F, refinedClass, SCOPE_CAPTURING_METHODS, superClassFields 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
ConstructorsConstructorDescriptionPrependedModule(Ruby runtime, RubyClass superClass, RubyModule prependedClass) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddMethod(String id, DynamicMethod method) protected IRubyObjectconstantTableRemove(String name) protected IRubyObjectconstantTableStore(String name, IRubyObject value) protected IRubyObjectconstantTableStore(String name, IRubyObject value, boolean hidden) protected IRubyObjectgetAutoloadConstant(String name, boolean forceLoad) protected Map<String,RubyModule.Autoload> AutoloadMap must be accessed after checking ConstantMap.protected Map<String,RubyModule.Autoload> protected Map<String,IRubyObject> protected Map<String,IRubyObject> getName()Generate a fully-qualified class name or a #-style name for anonymous and singleton classes.Deprecated.In an included or prepended module what is the ACTUAL module it represents?id()We don't want to reveal ourselves to Ruby code, so origin this operation.booleanisClass()Specifically polymorphic method that are meant to be overridden by classes to specify that they are classes in an easy way.booleanIs object immediate (def: Fixnum, Symbol, true, false, nil?).booleanisModule()Specifically polymorphic method that are meant to be overridden by modules to specify that they are modules in an easy way.booleanprivate booleanmoveRefinedMethod(String key, DynamicMethod method, RubyModule klass) Transfer refined methods from the prepend stub to the origin as markers so they trigger refinements MRI: move_refined_methodvoidsetMetaClass(RubyClass newRubyClass) Makes it possible to change the metaclass of an object.Methods inherited from class org.jruby.RubyClass
addClassAnnotation, addFieldAnnotation, addFieldSignature, addInvalidatorsAndFlush, addMethodAnnotation, addMethodSignature, addParameterAnnotation, addSubclass, allocate, becomeSynchronized, checkFuncallCallable, checkInheritable, createBootstrapClass, createClassClass, finvoke, finvoke, finvoke, finvoke, finvoke, finvoke, finvoke, finvoke, finvoke, finvoke, finvokeChecked, finvokeChecked, finvokeChecked, finvokeChecked, finvokeWithRefinements, finvokeWithRefinements, finvokeWithRefinements, finvokeWithRefinements, finvokeWithRefinements, getAllMethodSignatures, getAllocator, getBaseCallSite, getBaseCallSites, getClassAnnotations, getClassConfig, getClassRuntime, getExtraCallSites, getFFIHandleAccessorField, getFFIHandleAccessorForRead, getFFIHandleAccessorForWrite, getFieldAnnotations, getFieldSignatures, getIsReifiedExtendedJavaClass, getMarshal, getMethodAnnotations, getMethodSignatures, getNativeClassIndex, getObjectGroupAccessorField, getObjectGroupAccessorForRead, getObjectGroupAccessorForWrite, getObjectIdAccessorField, getParameterAnnotations, getPositionOrDefault, getRealClass, getRealModule, getReifiedClass, getReifiedJavaClass, getReifiedRubyClass, getVariableAccessorForRead, getVariableAccessorForWrite, getVariableAccessorsForRead, getVariableNames, getVariableTableCopy, getVariableTableManager, getVariableTableSize, getVariableTableSizeWithExtras, hasObjectID, inherit, inherited, initialize, initialize, initialize_copy, initialize19, initialize19, invalidateCacheDescendants, invoke, invoke, invoke, invoke, invoke, invoke, invoke, invoke, invoke, invoke, invoke, invokeFrom, invokeFrom, invokeFrom, invokeFrom, invokeFrom, invokeFrom, invokeFrom, invokeFrom, invokeFrom, invokeFrom, invokeInherited, invokePublic, isReifiable, isSingleton, marshal, marshalTo, nearestReifiedClass, newClass, newClass, newClass, newClass, newInstance, newInstance, newInstance, newInstance, newInstance, notVisibleAndNotMethodMissing, reify, reify, reify, reify, reifyWithAncestors, reifyWithAncestors, reifyWithAncestors, reifyWithAncestors, removeSubclass, replaceSubclass, setAllocator, setClassAllocator, setClassConfig, setMarshal, setModuleSuperClass, setReifiedClass, setRubyClassAllocator, setRubyStaticAllocator, smartDump, smartLoadNewUser, smartLoadOldUser, subclasses, subclasses, superclass, toJava, toSingletonClass, unmarshal, unmarshalFromMethods inherited from class org.jruby.RubyModule
addClassProvider, addIncludingHierarchy, addMethodAtBootTimeOnly, addMethodInternal, addMethodSymbols, addModuleFunction, addReadAttribute, addReadWriteAttribute, addToCache, addToCache, addWriteAttribute, alias_method, ancestors, ancestors, append_features, attr, attr_accessor, attr_accessor, attr_reader, attr_reader, attr_writer, attr19, autoload, autoload_p, autoloadingValue, checkForCyclicPrepend, checkFrozen, checkValidBindTargetFrom, class_variable_defined_p, class_variable_get, class_variable_get19, class_variable_set, class_variable_set19, class_variables, class_variables, class_variables19, cloneMethods, const_defined_p, const_defined_p, const_defined_p19, const_get, const_get, const_get_1_9, const_get_2_0, const_missing, const_set, constantEntryFetch, constants, constants, constants19, constants19, constantsCommon, constantsCommon, constantsCommon19, constantTableContains, constantTableFetch, constantTableStore, constDefined, constDefinedAt, constDefinedFrom, createModuleClass, define_method, define_method, define_method, defineAlias, defineAliases, defineAnnotatedConstant, defineAnnotatedConstants, defineAnnotatedMethod, defineAnnotatedMethod, defineAnnotatedMethod, defineAnnotatedMethod, defineAnnotatedMethods, defineAnnotatedMethodsIndividually, defineAutoload, defineClassUnder, defineConstant, defineMethodFromBlock, defineMethodFromCallable, defineModuleUnder, defineOrGetClassUnder, defineOrGetClassUnder, defineOrGetModuleUnder, deleteClassVariable, deleteConstant, deprecate_constant, deprecate_constant, deprecateConstant, discoverInstanceVariables, ensureClassVariablesSettable, ensureConstantsSettable, equals, exportMethod, extend_object, extended, fastFetchClassVariable, fastFetchConstant, fastGetClass, fastGetClassVar, fastGetConstant, fastGetConstant, fastGetConstantAt, fastGetConstantFrom, fastGetConstantFromConstMissing, fastGetConstantFromNoConstMissing, fastHasClassVariable, fastHasConstant, fastIsClassVarDefined, fastIsConstantDefined, fastIsConstantDefined19, fastIsConstantDefined19, fastSetClassVar, fastSetConstant, fastStoreClassVariable, fastStoreConstant, fetchClassVariable, fetchConstant, fetchConstant, findImplementer, finishAutoload, freeze, getAncestorList, getAutoloadConstant, getAutoloadFile, getBaseName, getCacheProxy, getCacheToken, getClass, getClassIndex, getClassVar, getClassVar, getClassVariableNameList, getClassVarQuiet, getConstant, getConstant, getConstant, getConstantAt, getConstantAt, getConstantAtSpecial, getConstantFrom, getConstantFromConstMissing, getConstantFromNoConstMissing, getConstantFromNoConstMissing, getConstantMap, getConstantMapForWrite, getConstantNames, getConstantNames, getConstantNoConstMissing, getConstantNoConstMissing, getConstantNoConstMissing, getConstantNoConstMissingSkipAutoload, getConstantNoConstMissingSKipAutoload, getConstantWithAutoload, getDelegate, getGeneration, getGenerationObject, getIdTest, getInvalidator, getJavaProxy, getMethodLocation, getMethods, getMethodsForWrite, getModule, getParent, getRefinements, getRefinementsForWrite, getSimpleName, getStoredConstantList, getStoredConstantNameList, getSuperClass, hasClassVariable, hasConstant, hash, hashCode, hasInternalModuleVariable, hasModuleInHierarchy, hasModuleInPrepends, hasPrepends, include, include, include_p, included, included_modules, includeModule, initialize, instance_method, instance_methods, instance_methods19, instanceMethods, instanceMethods, invalidateCacheDescendantsInner, invalidateConstantCache, invalidateConstantCaches, invalidateCoreClasses, isClassVarDefined, isConstantDefined, isConstantDefined, isIncluded, isIncludedIntoRefinement, isInstance, isKindOfModule, isMethodBound, isMethodBound, isMethodBuiltin, isRefinement, isSame, isSameOrigin, isSynchronized, loadPopulatorFor, marshalTo, method_added, method_defined_p, method_defined_p, method_removed, method_undefined, mix, mix, module_eval, module_eval, module_eval, module_eval, module_eval, module_exec, module_exec, module_function, name, name, name19, needsImplementer, nesting, newActivatedRefinementsMap, newIdTest, newIncludeClass, newMethod, newMethod, newMethod, newModule, newModule, newRefinementsMap, newRefinementsMap, op_cmp, op_eqq, op_equal, op_ge, op_gt, op_le, op_lt, populateInstanceMethodNames, prepend, prepend_features, prepended, prependModule, prependModule, private_class_method, private_constant, private_constant, private_instance_methods, private_instance_methods19, private_method_defined, private_method_defined, protected_instance_methods, protected_instance_methods19, protected_method_defined, protected_method_defined, public_class_method, public_constant, public_constant, public_instance_method, public_instance_methods, public_instance_methods19, public_method_defined, public_method_defined, publicConstDefinedFrom, putAlias, putAlias, putMethod, rbPrivate, rbProtected, rbPublic, refine, remove_class_variable, remove_class_variable19, remove_const, remove_method, removeClassProvider, removeClassVariable, removeMethod, resolveRefinedMethod, resolveUndefConstant, respondsToMethod, respondsToMethod, retrieveMethod, rubyBaseName, rubyName, searchAncestor, searchInternalModuleVariable, searchMethod, searchMethodCommon, searchMethodEntryInner, searchMethodInner, searchMethodLateral, searchWithCache, searchWithCache, searchWithRefinements, setBaseName, setCacheProxy, setClassIndex, setClassVar, setConstant, setConstant, setConstantQuiet, setConstantVisibility, setInternalModuleVariable, setJavaProxy, setMethodLocation, setMethodVisibility, setParent, setRefinements, setSuperClass, singleton_class_p, storeClassVariable, storeConstant, storeConstant, syncClassVariables, syncConstants, to_s, undef, undef_method, undefinedMethodMessage, undefineMethod, updateGeneration, used_modules, using, usingModule, validateClassVariable, validateClassVariable, validateClassVariable, validateConstant, validateConstantMethods 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, 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, 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, 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
-
origin
-
-
Constructor Details
-
PrependedModule
-
-
Method Details
-
moveRefinedMethod
Transfer refined methods from the prepend stub to the origin as markers so they trigger refinements MRI: move_refined_method -
isPrepended
public boolean isPrepended()- Overrides:
isPrependedin classRubyModule
-
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 classRubyClass- 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 classRubyClass- 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.
-
isImmediate
public boolean isImmediate()Description copied from class:RubyBasicObjectIs object immediate (def: Fixnum, Symbol, true, false, nil?).- Specified by:
isImmediatein interfaceIRubyObject- Overrides:
isImmediatein classRubyBasicObject- Returns:
-
setMetaClass
Description copied from class:RubyBasicObjectMakes it possible to change the metaclass of an object. In practice, this is a simple version of Smalltalks Become, except that it doesn't work when we're dealing with subclasses. In practice it's used to change the singleton/meta class used, without changing the "real" inheritance chain.- Overrides:
setMetaClassin classRubyBasicObject
-
getName
Description copied from class:RubyModuleGenerate a fully-qualified class name or a #-style name for anonymous and singleton classes. Ruby C equivalent = "classname"- Overrides:
getNamein classRubyModule- Returns:
- The generated class name
-
getOrigin
Description copied from class:RubyModuleIn an included or prepended module what is the ACTUAL module it represents?- Overrides:
getOriginin classRubyModule- Returns:
- the actual module of an included/prepended module.
-
getNonIncludedClass
Deprecated.- Overrides:
getNonIncludedClassin classRubyModule
-
id
We don't want to reveal ourselves to Ruby code, so origin this operation.- Specified by:
idin interfaceIRubyObject- Overrides:
idin classRubyBasicObject- Returns:
- the object id
-
addMethod
- Overrides:
addMethodin classRubyModule
-
getClassVariables
- Overrides:
getClassVariablesin classRubyModule
-
getClassVariablesForRead
- Overrides:
getClassVariablesForReadin classRubyModule
-
constantTableStore
- Overrides:
constantTableStorein classRubyModule
-
constantTableStore
- Overrides:
constantTableStorein classRubyModule
-
constantTableRemove
- Overrides:
constantTableRemovein classRubyModule
-
getAutoloadConstant
- Overrides:
getAutoloadConstantin classRubyModule
-
getAutoloadMap
Description copied from class:RubyModuleAutoloadMap 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.- Overrides:
getAutoloadMapin classRubyModule
-
getAutoloadMapForWrite
- Overrides:
getAutoloadMapForWritein classRubyModule
-