Top Description Fields Constructors Methods
org.jruby

public Class PrependedModule

extends RubyClass
implements DelegatedModule
Class Inheritance
All Implemented Interfaces
org.jruby.DelegatedModule
Imports
java.util.Collection, .Collections, .List, .Map, org.jruby.internal.runtime.methods.DynamicMethod, .RefinedMarker, org.jruby.runtime.ThreadContext, org.jruby.runtime.builtin.IRubyObject

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
org.jruby.IncludedModuleWrapper, org.jruby.RubyModule

Field Summary

Modifier and TypeField and Description
private RubyModule
Inherited from org.jruby.RubyClass:
CLASS_ALLOCATORCS_IDX_INITIALIZEDEFAULT_OBJECT_MARSHALEMPTY_RUBYCLASS_SETmarshalruntime

Constructor Summary

AccessConstructor and Description
public
PrependedModule(Ruby runtime, RubyClass superClass, RubyModule prependedClass)

Method Summary

Modifier and TypeMethod and Description
public void
protected RubyModule.ConstantEntry
protected IRubyObject
protected IRubyObject
protected IRubyObject
protected IRubyObject
protected Map<String, RubyModule.Autoload>
getAutoloadMap()

Overrides org.jruby.RubyModule.getAutoloadMap.

AutoloadMap must be accessed after checking ConstantMap.

protected Map<String, RubyModule.Autoload>
protected synchronized Map<String, IRubyObject>
protected Map<String, IRubyObject>
public RubyModule
public String
getName(ThreadContext context)

Overrides org.jruby.RubyModule.getName.

Generate a fully-qualified class name or a #-style name for anonymous and singleton classes.

public RubyModule
public RubyModule
getOrigin()

Overrides org.jruby.RubyModule.getOrigin.

In an included or prepended module what is the ACTUAL module it represents?

public IRubyObject
id()

Overrides org.jruby.RubyBasicObject.id.

Implements org.jruby.runtime.builtin.IRubyObject.id.

We don't want to reveal ourselves to Ruby code, so origin this operation.

public boolean
isClass()

Overrides org.jruby.RubyClass.isClass.

Implements org.jruby.runtime.builtin.IRubyObject.isClass.

Specifically polymorphic method that are meant to be overridden by classes to specify that they are classes in an easy way.

public boolean
isImmediate()

Overrides org.jruby.RubyBasicObject.isImmediate.

Implements org.jruby.runtime.builtin.IRubyObject.isImmediate.

Is object immediate (def: Fixnum, Symbol, true, false, nil?).

public boolean
isModule()

Overrides org.jruby.RubyClass.isModule.

Implements org.jruby.runtime.builtin.IRubyObject.isModule.

Specifically polymorphic method that are meant to be overridden by modules to specify that they are modules in an easy way.

public boolean
private boolean
moveRefinedMethod(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_method

public void
setMetaClass(RubyClass
the meta class to set
newRubyClass
)

Overrides org.jruby.RubyBasicObject.setMetaClass.

Makes it possible to change the metaclass of an object.

Inherited from org.jruby.RubyClass:
addAllSubclassesaddClassAnnotationaddFieldAnnotationaddFieldSignatureaddInvalidatorsAndFlushaddMethodAnnotationaddMethodSignatureaddParameterAnnotationaddSubclassallocateallocateallocatorattached_objectbecomeSynchronizedcheckFuncallCallablecheckInheritablecheckInheritablecheckMethodBasicDefinitioncreateBootstrapClassfinishClassClassfinishCreateClassClassfinvokefinvokefinvokefinvokefinvokefinvokefinvokefinvokefinvokefinvokefinvokeCheckedfinvokeCheckedfinvokeCheckedfinvokeCheckedfinvokeWithRefinementsfinvokeWithRefinementsfinvokeWithRefinementsfinvokeWithRefinementsfinvokeWithRefinementsgetAllMethodSignaturesgetAllocatorgetBaseCallSitegetBaseCallSitesgetClassAnnotationsgetClassConfiggetClassRuntimegetExtraCallSitesgetFFIHandleAccessorFieldgetFFIHandleAccessorForReadgetFFIHandleAccessorForWritegetFieldAnnotationsgetFieldSignaturesgetIsReifiedExtendedJavaClassgetMarshalgetMethodAnnotationsgetMethodSignaturesgetNativeClassIndexgetObjectGroupAccessorFieldgetObjectGroupAccessorForReadgetObjectGroupAccessorForWritegetObjectIdAccessorFieldgetParameterAnnotationsgetPositionOrDefaultgetRealClassgetRealModulegetReifiedClassgetReifiedJavaClassgetReifiedRubyClassgetSubclassesForReadgetVariableAccessorForReadgetVariableAccessorForWritegetVariableAccessorsForReadgetVariableNamesgetVariableTableCopygetVariableTableManagergetVariableTableSizegetVariableTableSizeWithExtrashasObjectIDinheritinheritedinitializeinitializeinitialize_copyinvalidateCacheDescendantsinvokeinvokeinvokeinvokeinvokeinvokeinvokeinvokeinvokeinvokeinvokeinvokeFrominvokeFrominvokeFrominvokeFrominvokeFrominvokeFrominvokeFrominvokeFrominvokeFrominvokeFrominvokeInheritedinvokePublicisReifiableisSingletonmarshalmarshalmarshalTomarshalTomarshalWithnearestReifiedClassnewClassnewClassnewClassnewClassnewClassnewClassnewClassnewClassnewClassBootstrapnewInstancenewInstancenewInstancenewInstancenewInstancenewInstancenotVisibleAndNotMethodMissingreifiedClassreifiedClassreifyreifyreifyreifyreifyWithAncestorsreifyWithAncestorsreifyWithAncestorsreifyWithAncestorsremoveSubclassreplaceSubclasssetAllocatorsetClassAllocatorsetClassConfigsetMarshalsetReifiedClasssetRubyClassAllocatorsetRubyStaticAllocatorsmartDumpsmartDumpsmartLoadNewUsersmartLoadOldUsersubclassessubclassessubclassessuperclasstoJavatoSingletonClasstoSingletonClassunmarshalunmarshalunmarshalFromunmarshalFrom

Field Detail

originback to summary
private RubyModule origin

Constructor Detail

PrependedModuleback to summary
public PrependedModule(Ruby runtime, RubyClass superClass, RubyModule prependedClass)

Method Detail

addMethodback to summary
public void addMethod(ThreadContext context, String id, DynamicMethod method)

Overrides org.jruby.RubyModule.addMethod.

Annotations
@Override
constantEntryFetchback to summary
protected RubyModule.ConstantEntry constantEntryFetch(String name)

Overrides org.jruby.RubyModule.constantEntryFetch.

Annotations
@Override
constantTableRemoveback to summary
protected IRubyObject constantTableRemove(String name)

Overrides org.jruby.RubyModule.constantTableRemove.

Annotations
@Override
constantTableStoreback to summary
protected IRubyObject constantTableStore(String name, IRubyObject value)

Overrides org.jruby.RubyModule.constantTableStore.

Annotations
@Override
constantTableStoreback to summary
protected IRubyObject constantTableStore(String name, IRubyObject value, boolean hidden)

Overrides org.jruby.RubyModule.constantTableStore.

getAutoloadConstantback to summary
protected IRubyObject getAutoloadConstant(ThreadContext context, String name, boolean forceLoad)

Overrides org.jruby.RubyModule.getAutoloadConstant.

Annotations
@Override
getAutoloadMapback to summary
protected Map<String, RubyModule.Autoload> getAutoloadMap()

Overrides org.jruby.RubyModule.getAutoloadMap.

Doc from org.jruby.RubyModule.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.

Annotations
@Override
getAutoloadMapForWriteback to summary
protected Map<String, RubyModule.Autoload> getAutoloadMapForWrite()

Overrides org.jruby.RubyModule.getAutoloadMapForWrite.

Annotations
@Override
getClassVariablesback to summary
protected synchronized Map<String, IRubyObject> getClassVariables()

Overrides org.jruby.RubyModule.getClassVariables.

Annotations
@Override
getClassVariablesForReadback to summary
protected Map<String, IRubyObject> getClassVariablesForRead()

Overrides org.jruby.RubyModule.getClassVariablesForRead.

Annotations
@Override
getDelegateback to summary
public RubyModule getDelegate()

Overrides org.jruby.RubyModule.getDelegate.

Implements org.jruby.DelegatedModule.getDelegate.

Annotations
@Override
getNameback to summary
public String getName(ThreadContext context)

Overrides org.jruby.RubyModule.getName.

Doc from org.jruby.RubyModule.getName.

Generate a fully-qualified class name or a #-style name for anonymous and singleton classes. Ruby C equivalent = "classname"

Returns:String

The generated class name

Annotations
@Override
getNonIncludedClassback to summary
public RubyModule getNonIncludedClass()

Overrides org.jruby.RubyModule.getNonIncludedClass.

Deprecated

Annotations
@Deprecated
@Override
getOriginback to summary
public RubyModule getOrigin()

Overrides org.jruby.RubyModule.getOrigin.

Doc from org.jruby.RubyModule.getOrigin.

In an included or prepended module what is the ACTUAL module it represents?

Returns:RubyModule

the actual module of an included/prepended module.

Annotations
@Override
idback to summary
public IRubyObject id()

Overrides org.jruby.RubyBasicObject.id.

Implements org.jruby.runtime.builtin.IRubyObject.id.

We don't want to reveal ourselves to Ruby code, so origin this operation.

Returns:IRubyObject

Doc from org.jruby.runtime.builtin.IRubyObject.id.

the object id

Annotations
@Override
isClassback to summary
public boolean isClass()

Overrides org.jruby.RubyClass.isClass.

Implements org.jruby.runtime.builtin.IRubyObject.isClass.

Doc from org.jruby.RubyBasicObject.isClass.

Specifically polymorphic method that are meant to be overridden by classes to specify that they are classes in an easy way.

Returns:boolean

Doc from org.jruby.runtime.builtin.IRubyObject.isClass.

true if an object is Ruby Class instance (note that it will return false for Ruby singleton classes).

Annotations
@Override
isImmediateback to summary
public boolean isImmediate()

Overrides org.jruby.RubyBasicObject.isImmediate.

Implements org.jruby.runtime.builtin.IRubyObject.isImmediate.

Doc from org.jruby.RubyBasicObject.isImmediate.

Is object immediate (def: Fixnum, Symbol, true, false, nil?).

Returns:boolean

Doc from org.jruby.runtime.builtin.IRubyObject.isImmediate.

boolean

Annotations
@Override
isModuleback to summary
public boolean isModule()

Overrides org.jruby.RubyClass.isModule.

Implements org.jruby.runtime.builtin.IRubyObject.isModule.

Doc from org.jruby.RubyBasicObject.isModule.

Specifically polymorphic method that are meant to be overridden by modules to specify that they are modules in an easy way.

Returns:boolean

Doc from org.jruby.runtime.builtin.IRubyObject.isModule.

true if an object is Ruby Module instance (note that it will return false for Ruby Classes).

Annotations
@Override
isPrependedback to summary
public boolean isPrepended()

Overrides org.jruby.RubyModule.isPrepended.

Annotations
@Override
moveRefinedMethodback to summary
private boolean moveRefinedMethod(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_method

setMetaClassback to summary
public void setMetaClass(RubyClass newRubyClass)

Overrides org.jruby.RubyBasicObject.setMetaClass.

Doc from org.jruby.RubyBasicObject.setMetaClass.

Makes 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.

Parameters
newRubyClass:RubyClass

the meta class to set

Annotations
@Override