public class RubyModule extends RubyObject
Modifier and Type | Class and Description |
---|---|
protected static class |
RubyModule.CacheEntryFactory |
static class |
RubyModule.ConstantEntry
Represents a constant value, possibly hidden (private).
|
static class |
RubyModule.JavaClassKindOf |
static class |
RubyModule.KindOf |
static class |
RubyModule.MethodClumper |
static class |
RubyModule.ModuleKernelMethods |
protected static class |
RubyModule.ProfilingCacheEntryFactory |
static class |
RubyModule.RespondToMissingMethod |
protected static class |
RubyModule.SynchronizedCacheEntryFactory |
protected static class |
RubyModule.WrapperCacheEntryFactory
A wrapper CacheEntryFactory, for delegating cache entry creation along a chain.
|
RubyObject.Data
RubyBasicObject.Finalizer
Modifier and Type | Field and Description |
---|---|
protected String |
baseName
The base name of this class/module, excluding nesting.
|
protected Map<String,CacheEntry> |
cachedMethods |
protected static String |
ERR_FROZEN_CONST_TYPE |
protected static String |
ERR_FROZEN_CVAR_TYPE |
protected static String |
ERR_INSECURE_SET_CLASS_VAR |
protected static String |
ERR_INSECURE_SET_CONSTANT |
protected int |
generation |
protected Integer |
generationObject |
int |
id |
protected Set<RubyClass> |
includingHierarchies |
int |
index
The index of this class in the ClassIndex.
|
RubyModule.KindOf |
kindOf |
protected Invalidator |
methodInvalidator |
static ObjectAllocator |
MODULE_ALLOCATOR |
protected static RubyModule.CacheEntryFactory |
NormalCacheEntryFactory |
RubyModule |
parent
The class/module within whose namespace this class/module resides.
|
static Set<String> |
SCOPE_CAPTURING_METHODS |
protected RubyClass |
superClass |
FIELD_ALLOCATED_CLASSES, FIELD_ALLOCATORS, IVAR_INSPECTING_OBJECT_ALLOCATOR, OBJECT_ALLOCATOR, OBJECT_VAR0_ALLOCATOR, OBJECT_VAR1_ALLOCATOR, OBJECT_VAR2_ALLOCATOR, OBJECT_VAR3_ALLOCATOR, OBJECT_VAR4_ALLOCATOR, OBJECT_VAR5_ALLOCATOR, OBJECT_VAR6_ALLOCATOR, OBJECT_VAR7_ALLOCATOR, OBJECT_VAR8_ALLOCATOR, OBJECT_VAR9_ALLOCATOR, REIFYING_OBJECT_ALLOCATOR
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, UNTRUSTED_F, USER0_F, USER1_F, USER2_F, USER3_F, USER4_F, USER5_F, USER6_F, USER7_F, USER8_F, VAR_TABLE_OFFSET, varTable, varTableStamp
NULL_ARRAY
Modifier | Constructor and Description |
---|---|
protected |
RubyModule(Ruby runtime)
standard path for Module construction
|
protected |
RubyModule(Ruby runtime,
RubyClass metaClass)
used by MODULE_ALLOCATOR and RubyClass constructors
|
protected |
RubyModule(Ruby runtime,
RubyClass metaClass,
boolean objectSpace)
separate path for MetaClass construction
|
Modifier and Type | Method and Description |
---|---|
void |
addClassProvider(ClassProvider provider) |
void |
addIncludingHierarchy(IncludedModuleWrapper hierarchy) |
void |
addMethod(String name,
DynamicMethod method) |
void |
addMethodAtBootTimeOnly(String name,
DynamicMethod method)
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.
|
void |
addMethodInternal(String name,
DynamicMethod method) |
void |
addModuleFunction(String name,
DynamicMethod method) |
void |
addReadAttribute(ThreadContext context,
String name) |
void |
addReadWriteAttribute(ThreadContext context,
String name) |
void |
addWriteAttribute(ThreadContext context,
String name) |
RubyModule |
alias_method(ThreadContext context,
IRubyObject newId,
IRubyObject oldId) |
RubyArray |
ancestors()
Deprecated.
|
RubyArray |
ancestors(ThreadContext context)
rb_mod_ancestors
|
RubyModule |
append_features(IRubyObject module)
rb_mod_append_features
|
IRubyObject |
attr_accessor(IRubyObject[] args)
Deprecated.
|
IRubyObject |
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.
|
IRubyObject |
attr_reader(IRubyObject[] args)
Deprecated.
|
IRubyObject |
attr_reader(ThreadContext context,
IRubyObject[] args)
rb_mod_attr_reader
|
IRubyObject |
attr_writer(ThreadContext context,
IRubyObject[] args)
rb_mod_attr_writer
|
IRubyObject |
attr(ThreadContext context,
IRubyObject[] args)
rb_mod_attr
|
IRubyObject |
attr19(ThreadContext context,
IRubyObject[] args) |
void |
becomeSynchronized() |
void |
checkMethodBound(ThreadContext context,
IRubyObject[] args,
Visibility visibility)
Deprecated.
|
void |
checkValidBindTargetFrom(ThreadContext context,
RubyModule originModule) |
IRubyObject |
class_variable_defined_p(ThreadContext context,
IRubyObject var) |
IRubyObject |
class_variable_get(IRubyObject var)
rb_mod_cvar_get
|
IRubyObject |
class_variable_get19(IRubyObject var) |
IRubyObject |
class_variable_set(IRubyObject var,
IRubyObject value)
rb_mod_cvar_set
|
IRubyObject |
class_variable_set19(IRubyObject var,
IRubyObject value) |
RubyArray |
class_variables(ThreadContext context)
rb_mod_class_variables
|
RubyArray |
class_variables19(ThreadContext context) |
protected IRubyObject |
cloneMethods(RubyModule clone) |
RubyBoolean |
const_defined_p(ThreadContext context,
IRubyObject symbol)
rb_mod_const_defined
|
RubyBoolean |
const_defined_p19(ThreadContext context,
IRubyObject[] args) |
IRubyObject |
const_get_1_9(ThreadContext context,
IRubyObject[] args) |
IRubyObject |
const_get_2_0(ThreadContext context,
IRubyObject[] args) |
IRubyObject |
const_get(IRubyObject symbol)
rb_mod_const_get
|
IRubyObject |
const_missing(ThreadContext context,
IRubyObject rubyName,
Block block)
Base implementation of Module#const_missing, throws NameError for specific missing constant.
|
IRubyObject |
const_set(IRubyObject symbol,
IRubyObject value)
rb_mod_const_set
|
protected RubyModule.ConstantEntry |
constantEntryFetch(String name) |
RubyArray |
constants(ThreadContext context) |
RubyArray |
constants19(ThreadContext context) |
RubyArray |
constants19(ThreadContext context,
IRubyObject allConstants) |
Collection<String> |
constantsCommon(Ruby runtime,
boolean replaceModule,
boolean allConstants)
rb_mod_constants
|
Collection<String> |
constantsCommon(Ruby runtime,
boolean replaceModule,
boolean allConstants,
boolean includePrivate) |
RubyArray |
constantsCommon19(ThreadContext context,
boolean replaceModule,
boolean allConstants) |
protected boolean |
constantTableContains(String name) |
protected IRubyObject |
constantTableFetch(String name) |
protected IRubyObject |
constantTableRemove(String name) |
protected IRubyObject |
constantTableStore(String name,
IRubyObject value) |
static RubyClass |
createModuleClass(Ruby runtime,
RubyClass moduleClass) |
IRubyObject |
define_method(ThreadContext context,
IRubyObject[] args,
Block block)
Deprecated.
|
IRubyObject |
define_method(ThreadContext context,
IRubyObject arg0,
Block block) |
IRubyObject |
define_method(ThreadContext context,
IRubyObject arg0,
IRubyObject arg1,
Block block) |
void |
defineAlias(String name,
String oldName)
rb_alias
|
void |
defineAliases(List<String> aliases,
String oldName) |
boolean |
defineAnnotatedConstant(Field field) |
void |
defineAnnotatedConstants(Class clazz) |
void |
defineAnnotatedMethod(Class clazz,
String name) |
boolean |
defineAnnotatedMethod(Method method,
MethodFactory methodFactory) |
boolean |
defineAnnotatedMethod(String name,
JavaMethodDescriptor desc,
MethodFactory methodFactory) |
boolean |
defineAnnotatedMethod(String name,
List<JavaMethodDescriptor> methods,
MethodFactory methodFactory) |
void |
defineAnnotatedMethods(Class clazz) |
void |
defineAnnotatedMethodsIndividually(Class clazz) |
protected void |
defineAutoload(String name,
IAutoloadMethod loadMethod)
Define an autoload.
|
RubyClass |
defineClassUnder(String name,
RubyClass superClass,
ObjectAllocator allocator)
rb_define_class_under
this method should be used only as an API to define/open nested classes
|
void |
defineConstant(String name,
IRubyObject value)
rb_define_const
|
void |
defineFastMethod(String name,
Callback method)
Deprecated.
|
void |
defineFastMethod(String name,
Callback method,
Visibility visibility)
Deprecated.
|
void |
defineFastModuleFunction(String name,
Callback method)
Deprecated.
|
void |
defineFastPrivateMethod(String name,
Callback method)
Deprecated.
|
void |
defineFastProtectedMethod(String name,
Callback method)
Deprecated.
|
void |
defineFastPublicModuleFunction(String name,
Callback method)
Deprecated.
|
void |
defineMethod(String name,
Callback method)
Deprecated.
|
void |
defineModuleFunction(String name,
Callback method)
Deprecated.
|
RubyModule |
defineModuleUnder(String name)
rb_define_module_under
this method should be used only as an API to define/open nested module
|
RubyClass |
defineOrGetClassUnder(String name,
RubyClass superClazz)
this method should be used only by interpreter or compiler
|
RubyModule |
defineOrGetModuleUnder(String name)
this method should be used only by interpreter or compiler
|
void |
definePrivateMethod(String name,
Callback method)
Deprecated.
|
void |
definePublicModuleFunction(String name,
Callback method)
Deprecated.
|
IRubyObject |
deleteClassVariable(String name) |
IRubyObject |
deleteConstant(String name) |
Set<String> |
discoverInstanceVariables() |
protected void |
ensureClassVariablesSettable() |
protected void |
ensureConstantsSettable() |
boolean |
equals(Object other)
We override equals here to provide a faster path, since equality for modules
is pretty cut and dried.
|
IRubyObject |
executeUnder(ThreadContext context,
Callback method,
IRubyObject[] args,
Block block)
Deprecated.
|
void |
exportMethod(String name,
Visibility visibility)
rb_export_method
|
IRubyObject |
extend_object(IRubyObject obj)
rb_mod_extend_object
|
IRubyObject |
extended(ThreadContext context,
IRubyObject other,
Block block) |
IRubyObject |
fastFetchClassVariable(String internedName)
Deprecated.
|
IRubyObject |
fastFetchConstant(String internedName)
Deprecated.
|
RubyClass |
fastGetClass(String internedName)
Deprecated.
|
IRubyObject |
fastGetClassVar(String internedName)
Deprecated.
|
IRubyObject |
fastGetConstant(String internedName)
Deprecated.
|
IRubyObject |
fastGetConstant(String internedName,
boolean inherit)
Deprecated.
|
IRubyObject |
fastGetConstantAt(String internedName)
Deprecated.
|
IRubyObject |
fastGetConstantFrom(String internedName)
Deprecated.
|
IRubyObject |
fastGetConstantFromConstMissing(String internedName)
Deprecated.
|
IRubyObject |
fastGetConstantFromNoConstMissing(String internedName)
Deprecated.
|
boolean |
fastHasClassVariable(String internedName)
Deprecated.
|
boolean |
fastHasConstant(String internedName)
Deprecated.
|
boolean |
fastIsClassVarDefined(String internedName)
Deprecated.
|
boolean |
fastIsConstantDefined(String internedName) |
boolean |
fastIsConstantDefined19(String internedName) |
boolean |
fastIsConstantDefined19(String internedName,
boolean inherit) |
IRubyObject |
fastSetClassVar(String internedName,
IRubyObject value)
Deprecated.
|
IRubyObject |
fastSetConstant(String internedName,
IRubyObject value)
Deprecated.
|
IRubyObject |
fastStoreClassVariable(String internedName,
IRubyObject value)
Deprecated.
|
IRubyObject |
fastStoreConstant(String internedName,
IRubyObject value)
Deprecated.
|
IRubyObject |
fetchClassVariable(String name) |
IRubyObject |
fetchConstant(String name) |
IRubyObject |
fetchConstant(String name,
boolean includePrivate) |
RubyModule |
findImplementer(RubyModule clazz)
Find the given class in this hierarchy, considering modules along the way.
|
protected IRubyObject |
finishAutoload(String name)
Extract an Object which is defined by autoload thread from autoloadMap and define it as a constant.
|
IRubyObject |
freeze(ThreadContext context)
rb_mod_freeze
|
List<IRubyObject> |
getAncestorList() |
IRubyObject |
getAutoloadConstant(String name)
Get autoload constant.
|
protected String |
getAutoloadFile(String name) |
String |
getBaseName()
Get the base name of this class, or null if it is an anonymous class.
|
boolean |
getCacheProxy()
Get whether this Java proxy class should try to keep its instances idempotent
and alive using the ObjectProxyCache.
|
int |
getCacheToken()
Deprecated.
|
RubyClass |
getClass(String name)
Finds a class that is within the current module (or class).
|
IRubyObject |
getClassVar(String name)
Retrieve the specified class variable, searching through this module, included modules, and supermodules.
|
List<String> |
getClassVariableNameList() |
protected Map<String,IRubyObject> |
getClassVariables() |
protected Map<String,IRubyObject> |
getClassVariablesForRead() |
IRubyObject |
getConstant(String name)
Retrieve the named constant, invoking 'const_missing' should that be appropriate.
|
IRubyObject |
getConstant(String name,
boolean inherit) |
IRubyObject |
getConstant(String name,
boolean inherit,
boolean includeObject) |
IRubyObject |
getConstantAt(String name) |
IRubyObject |
getConstantAt(String name,
boolean includePrivate) |
IRubyObject |
getConstantAtSpecial(String name)
This version searches superclasses if we're starting with Object.
|
IRubyObject |
getConstantFrom(String name) |
IRubyObject |
getConstantFromConstMissing(String name) |
IRubyObject |
getConstantFromNoConstMissing(String name) |
IRubyObject |
getConstantFromNoConstMissing(String name,
boolean includePrivate) |
Map<String,RubyModule.ConstantEntry> |
getConstantMap() |
Map<String,RubyModule.ConstantEntry> |
getConstantMapForWrite() |
Collection<String> |
getConstantNames() |
Collection<String> |
getConstantNames(boolean includePrivate) |
IRubyObject |
getConstantNoConstMissing(String name) |
IRubyObject |
getConstantNoConstMissing(String name,
boolean inherit) |
IRubyObject |
getConstantNoConstMissing(String name,
boolean inherit,
boolean includeObject) |
int |
getGeneration() |
Integer |
getGenerationObject() |
Invalidator |
getInvalidator() |
boolean |
getJavaProxy()
Get whether this class is associated with (i.e.
|
Map<String,DynamicMethod> |
getMethods() |
Map<String,DynamicMethod> |
getMethodsForWrite() |
String |
getName()
Generate a fully-qualified class name or a #-style name for anonymous and singleton classes.
|
int |
getNativeTypeIndex()
This is overridden in the other concrete Java builtins to provide a fast way
to determine what type they are.
|
RubyModule |
getNonIncludedClass() |
RubyModule |
getParent() |
String |
getSimpleName()
Get the "simple" name for the class, which is either the "base" name or
the "anonymous" class name.
|
List<Variable<IRubyObject>> |
getStoredConstantList()
Deprecated.
|
List<String> |
getStoredConstantNameList()
Deprecated.
|
RubyClass |
getSuperClass()
Getter for property superClass.
|
boolean |
hasClassVariable(String name) |
boolean |
hasConstant(String name) |
RubyFixnum |
hash()
rb_obj_id
Will return the hash code of this object.
|
int |
hashCode()
Override the Object#hashCode method to make sure that the Ruby
hash is actually used as the hashcode for Ruby objects.
|
boolean |
hasInternalModuleVariable(String name)
Behaves similarly to
getClassVar(String) . |
boolean |
hasModuleInHierarchy(RubyModule type) |
IRubyObject |
include_p(ThreadContext context,
IRubyObject arg) |
RubyModule |
include(IRubyObject[] modules)
rb_mod_include
|
RubyArray |
included_modules(ThreadContext context)
rb_mod_included_modules
|
IRubyObject |
included(ThreadContext context,
IRubyObject other) |
void |
includeModule(IRubyObject arg)
Include a new module in this module or class.
|
IRubyObject |
initialize_copy(IRubyObject original)
rb_mod_init_copy
|
IRubyObject |
initialize(Block block)
Deprecated.
|
IRubyObject |
initialize(ThreadContext context,
Block block)
rb_mod_initialize
|
IRubyObject |
instance_method(IRubyObject symbol) |
RubyArray |
instance_methods(IRubyObject[] args) |
RubyArray |
instance_methods19(IRubyObject[] args) |
void |
invalidateCacheDescendants() |
protected void |
invalidateCacheDescendantsInner()
Deprecated.
|
protected void |
invalidateConstantCache(String constantName) |
protected void |
invalidateCoreClasses() |
boolean |
isClass()
Specifically polymorphic method that are meant to be overridden
by classes to specify that they are classes in an easy way.
|
boolean |
isClassVarDefined(String name)
Is class var defined?
Ruby C equivalent = "rb_cvar_defined"
|
boolean |
isConstantDefined(String name)
rb_const_defined_at
|
boolean |
isIncluded()
Is this module one that in an included one (e.g.
|
boolean |
isInstance(IRubyObject object) |
boolean |
isKindOfModule(RubyModule type) |
boolean |
isMethodBound(String name,
boolean checkVisibility)
MRI: rb_method_boundp
|
boolean |
isMethodBound(String name,
boolean checkVisibility,
boolean checkRespondTo) |
boolean |
isModule()
Specifically polymorphic method that are meant to be overridden
by modules to specify that they are modules in an easy way.
|
protected boolean |
isSame(RubyModule module) |
boolean |
isSingleton() |
boolean |
isSynchronized() |
static void |
marshalTo(RubyModule module,
MarshalStream output) |
IRubyObject |
method_added(ThreadContext context,
IRubyObject nothing) |
RubyBoolean |
method_defined_p(ThreadContext context,
IRubyObject symbol) |
IRubyObject |
method_removed(ThreadContext context,
IRubyObject nothing) |
IRubyObject |
method_undefined(ThreadContext context,
IRubyObject nothing) |
IRubyObject |
mix(ThreadContext context,
IRubyObject mod) |
IRubyObject |
mix(ThreadContext context,
IRubyObject mod,
IRubyObject hash0) |
IRubyObject |
module_eval(ThreadContext context,
Block block) |
IRubyObject |
module_eval(ThreadContext context,
IRubyObject[] args,
Block block)
Deprecated.
|
IRubyObject |
module_eval(ThreadContext context,
IRubyObject arg0,
Block block) |
IRubyObject |
module_eval(ThreadContext context,
IRubyObject arg0,
IRubyObject arg1,
Block block) |
IRubyObject |
module_eval(ThreadContext context,
IRubyObject arg0,
IRubyObject arg1,
IRubyObject arg2,
Block block) |
IRubyObject |
module_exec(ThreadContext context,
Block block) |
IRubyObject |
module_exec(ThreadContext context,
IRubyObject[] args,
Block block) |
RubyModule |
module_function(ThreadContext context,
IRubyObject[] args)
rb_mod_modfunc
|
IRubyObject |
name() |
IRubyObject |
name19() |
boolean |
needsImplementer() |
static RubyArray |
nesting(ThreadContext context,
IRubyObject recv,
Block block)
Return an array of nested modules or classes.
|
IncludedModuleWrapper |
newIncludeClass(RubyClass superClazz)
Deprecated.
|
IRubyObject |
newMethod(IRubyObject receiver,
String methodName,
boolean bound,
Visibility visibility) |
IRubyObject |
newMethod(IRubyObject receiver,
String methodName,
boolean bound,
Visibility visibility,
boolean respondToMissing) |
IRubyObject |
newMethod(IRubyObject receiver,
String methodName,
boolean bound,
Visibility visibility,
boolean respondToMissing,
boolean priv) |
static RubyModule |
newModule(Ruby runtime)
rb_module_new
|
static RubyModule |
newModule(Ruby runtime,
String name,
RubyModule parent,
boolean setParent)
rb_module_new/rb_define_module_id/rb_name_class/rb_set_class_path
|
IRubyObject |
op_cmp(IRubyObject obj)
rb_mod_cmp
|
RubyBoolean |
op_eqq(ThreadContext context,
IRubyObject obj)
rb_mod_eqq
|
IRubyObject |
op_equal(ThreadContext context,
IRubyObject other) |
IRubyObject |
op_ge(IRubyObject obj)
rb_mod_ge
|
IRubyObject |
op_gt(IRubyObject obj)
rb_mod_gt
|
IRubyObject |
op_le(IRubyObject obj)
rb_mod_le
|
IRubyObject |
op_lt(IRubyObject obj)
rb_mod_lt
|
void |
populateInstanceMethodNames(Set<String> seen,
RubyArray ary,
Visibility visibility,
boolean not,
boolean useSymbols,
boolean includeSuper) |
RubyModule |
private_class_method(IRubyObject[] args) |
IRubyObject |
private_constant(ThreadContext context,
IRubyObject rubyName) |
IRubyObject |
private_constant(ThreadContext context,
IRubyObject[] rubyNames) |
RubyArray |
private_instance_methods(IRubyObject[] args)
rb_class_private_instance_methods
|
RubyArray |
private_instance_methods19(IRubyObject[] args) |
IRubyObject |
private_method_defined(ThreadContext context,
IRubyObject symbol) |
RubyArray |
protected_instance_methods(IRubyObject[] args)
rb_class_protected_instance_methods
|
RubyArray |
protected_instance_methods19(IRubyObject[] args) |
IRubyObject |
protected_method_defined(ThreadContext context,
IRubyObject symbol) |
RubyModule |
public_class_method(IRubyObject[] args) |
IRubyObject |
public_constant(ThreadContext context,
IRubyObject rubyName) |
IRubyObject |
public_constant(ThreadContext context,
IRubyObject[] rubyNames) |
RubyArray |
public_instance_methods(IRubyObject[] args) |
RubyArray |
public_instance_methods19(IRubyObject[] args) |
IRubyObject |
public_method_defined(ThreadContext context,
IRubyObject symbol) |
RubyModule |
rbPrivate(ThreadContext context,
IRubyObject[] args)
rb_mod_private
|
RubyModule |
rbProtected(ThreadContext context,
IRubyObject[] args)
rb_mod_protected
|
RubyModule |
rbPublic(ThreadContext context,
IRubyObject[] args)
rb_mod_public
|
IRubyObject |
remove_class_variable(ThreadContext context,
IRubyObject name)
rb_mod_remove_cvar
|
IRubyObject |
remove_class_variable19(ThreadContext context,
IRubyObject name) |
IRubyObject |
remove_const(ThreadContext context,
IRubyObject rubyName) |
RubyModule |
remove_method(ThreadContext context,
IRubyObject[] args) |
void |
removeClassProvider(ClassProvider provider) |
IRubyObject |
removeClassVariable(String name) |
IRubyObject |
removeCvar(IRubyObject name)
Deprecated.
|
void |
removeMethod(ThreadContext context,
String name) |
IRubyObject |
resolveUndefConstant(String name) |
DynamicMethod |
retrieveMethod(String name)
Search through this module and supermodules for method definitions.
|
IRubyObject |
searchInternalModuleVariable(String name)
Behaves similarly to
getClassVar(String) . |
DynamicMethod |
searchMethod(String name)
Search through this module and supermodules for method definitions.
|
DynamicMethod |
searchMethodInner(String name) |
CacheEntry |
searchWithCache(String name)
Search through this module and supermodules for method definitions.
|
void |
setBaseName(String name)
Set the base name of the class.
|
void |
setCacheProxy(boolean cacheProxy)
Set whether this Java proxy class should try to keep its instances idempotent
and alive using the ObjectProxyCache.
|
IRubyObject |
setClassVar(String name,
IRubyObject value)
Set the named class variable to the given value, provided taint and freeze allow setting it.
|
IRubyObject |
setConstant(String name,
IRubyObject value)
Set the named constant on this module.
|
IRubyObject |
setConstantQuiet(String name,
IRubyObject value)
Set the named constant on this module.
|
void |
setInternalModuleVariable(String name,
IRubyObject value)
Behaves similarly to
setClassVar(String, IRubyObject) . |
void |
setJavaProxy(boolean javaProxy)
Set whether this class is associated with (i.e.
|
void |
setMethodVisibility(IRubyObject[] methods,
Visibility visibility)
set_method_visibility
|
void |
setParent(RubyModule parent) |
void |
setSuperClass(RubyClass superClass) |
IRubyObject |
storeClassVariable(String name,
IRubyObject value) |
IRubyObject |
storeConstant(String name,
IRubyObject value) |
void |
syncClassVariables(RubyModule other) |
void |
syncConstants(RubyModule other) |
IRubyObject |
to_s()
rb_mod_to_s
|
RubyModule |
undef_method(ThreadContext context,
IRubyObject[] args) |
void |
undef(ThreadContext context,
String name)
rb_undef
|
void |
undefineMethod(String name) |
static RubyModule |
unmarshalFrom(UnmarshalStream input) |
void |
updateGeneration() |
protected String |
validateClassVariable(String name) |
protected String |
validateConstant(String name) |
void |
visitInterpretedMethods(NodeVisitor visitor)
Visit all interpreted methods in this module (and superclasses, if this
is a class with superclasses) using the given visitor.
|
attachToObjectSpace, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, convertToType, createObjectClass, eqlInternal, equalInternal, initialize, initialize, inspect, puts, specificEval, toString
addFinalizer, anyToString, asJavaString, asString, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callSuper, checkArrayType, checkCallMethod, checkFrozen, checkStringType, checkStringType19, compareTo, convertToArray, convertToFloat, convertToHash, convertToInteger, convertToInteger, convertToInteger, convertToString, copyInstanceVariablesInto, copySpecialInstanceVariables, createBasicObjectClass, dataGetStruct, dataGetStructChecked, dataWrapStruct, display, dup, ensureInstanceVariablesSettable, eql_p, eql, 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, getNativeHandle, getObjectId, getRuntime, getSingletonClass, getSingletonClassClone, getType, getVariable, getVariableCount, getVariableList, getVariableNameList, hashyInspect, hasInstanceVariable, hasInternalVariable, hasVariables, id_deprecated, id, infectBy, 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, isTaint, isTrue, isUntrusted, kind_of_p, makeMetaClass, method_missing19, method, method19, methods, methods, methods19, nil_p, op_cmp, op_equal_19, op_match, op_match19, op_not_equal, op_not_match, op_not, private_methods, private_methods19, protected_methods, protected_methods19, public_methods, public_methods19, rbClone, remove_instance_variable, removeFinalizers, removeInstanceVariable, removeInternalVariable, 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_added19, singleton_method_removed19, singleton_method_undefined19, singleton_methods, singleton_methods19, specificEval, specificEval, specificEval, specificEval, syncVariables, syncVariables, taint, taint, tainted_p, testFrozen, testFrozen, to_a, toJava, trust, type_deprecated, type, untaint, untrust, untrusted_p, validateInstanceVariable, variableTableContains, variableTableFastContains, variableTableFastFetch, variableTableFastStore, variableTableFetch, variableTableRemove, variableTableStore, variableTableSync, yieldUnder, yieldUnder
protected static final String ERR_INSECURE_SET_CONSTANT
protected static final String ERR_FROZEN_CONST_TYPE
public static final ObjectAllocator MODULE_ALLOCATOR
protected static final RubyModule.CacheEntryFactory NormalCacheEntryFactory
protected static final String ERR_INSECURE_SET_CLASS_VAR
protected static final String ERR_FROZEN_CVAR_TYPE
public RubyModule.KindOf kindOf
public final int id
public RubyModule parent
protected String baseName
protected Map<String,CacheEntry> cachedMethods
protected int generation
protected Integer generationObject
protected RubyClass superClass
public int index
ClassIndex
protected final Invalidator methodInvalidator
protected RubyModule(Ruby runtime, RubyClass metaClass, boolean objectSpace)
protected RubyModule(Ruby runtime, RubyClass metaClass)
protected RubyModule(Ruby runtime)
public void checkValidBindTargetFrom(ThreadContext context, RubyModule originModule) throws RaiseException
RaiseException
public int getNativeTypeIndex()
RubyObject
getNativeTypeIndex
in interface CoreObjectType
getNativeTypeIndex
in class RubyObject
ClassIndex
public boolean isModule()
RubyBasicObject
isModule
in interface IRubyObject
isModule
in class RubyBasicObject
(someObject instanceof RubyModule)
instead.public boolean isClass()
RubyBasicObject
isClass
in interface IRubyObject
isClass
in class RubyBasicObject
(someObject instanceof RubyClass/MetaClass)
instead.public boolean isSingleton()
public boolean isInstance(IRubyObject object)
public Map<String,RubyModule.ConstantEntry> getConstantMap()
public Map<String,RubyModule.ConstantEntry> getConstantMapForWrite()
public void addIncludingHierarchy(IncludedModuleWrapper hierarchy)
public boolean needsImplementer()
public static RubyModule newModule(Ruby runtime)
public static RubyModule newModule(Ruby runtime, String name, RubyModule parent, boolean setParent)
public void addClassProvider(ClassProvider provider)
public void removeClassProvider(ClassProvider provider)
public RubyClass getSuperClass()
public void setSuperClass(RubyClass superClass)
public RubyModule getParent()
public void setParent(RubyModule parent)
public Map<String,DynamicMethod> getMethods()
public Map<String,DynamicMethod> getMethodsForWrite()
public boolean isIncluded()
public RubyModule getNonIncludedClass()
public String getBaseName()
public void setBaseName(String name)
name
- the new base name of the classpublic String getName()
public String getSimpleName()
@Deprecated public IncludedModuleWrapper newIncludeClass(RubyClass superClazz)
public RubyClass getClass(String name)
name
- to be found in this module (or class)@Deprecated public RubyClass fastGetClass(String internedName)
public void includeModule(IRubyObject arg)
arg
- The module to includepublic void defineAnnotatedConstants(Class clazz)
public boolean defineAnnotatedConstant(Field field)
public void defineAnnotatedMethods(Class clazz)
public void defineAnnotatedMethodsIndividually(Class clazz)
public boolean defineAnnotatedMethod(String name, List<JavaMethodDescriptor> methods, MethodFactory methodFactory)
public boolean defineAnnotatedMethod(Method method, MethodFactory methodFactory)
public boolean defineAnnotatedMethod(String name, JavaMethodDescriptor desc, MethodFactory methodFactory)
public void undefineMethod(String name)
public void undef(ThreadContext context, String name)
public IRubyObject include_p(ThreadContext context, IRubyObject arg)
public void addMethod(String name, DynamicMethod method)
public void addMethodInternal(String name, DynamicMethod method)
public void addMethodAtBootTimeOnly(String name, DynamicMethod method)
name
- The name to which to bind the methodmethod
- The method to bindpublic void removeMethod(ThreadContext context, String name)
public DynamicMethod searchMethod(String name)
name
- The name of the method to search forpublic CacheEntry searchWithCache(String name)
name
- The name of the method to search for@Deprecated public final int getCacheToken()
public final int getGeneration()
public final Integer getGenerationObject()
public void becomeSynchronized()
public boolean isSynchronized()
public DynamicMethod searchMethodInner(String name)
public void invalidateCacheDescendants()
protected void invalidateCoreClasses()
public Invalidator getInvalidator()
public void updateGeneration()
@Deprecated protected void invalidateCacheDescendantsInner()
protected void invalidateConstantCache(String constantName)
public DynamicMethod retrieveMethod(String name)
name
- The name of the method to search forpublic RubyModule findImplementer(RubyModule clazz)
clazz
- the class to findpublic void addModuleFunction(String name, DynamicMethod method)
public RubyClass defineOrGetClassUnder(String name, RubyClass superClazz)
public RubyModule defineOrGetModuleUnder(String name)
public RubyClass defineClassUnder(String name, RubyClass superClass, ObjectAllocator allocator)
public RubyModule defineModuleUnder(String name)
public void setMethodVisibility(IRubyObject[] methods, Visibility visibility)
public void exportMethod(String name, Visibility visibility)
public boolean isMethodBound(String name, boolean checkVisibility)
public boolean isMethodBound(String name, boolean checkVisibility, boolean checkRespondTo)
public IRubyObject newMethod(IRubyObject receiver, String methodName, boolean bound, Visibility visibility)
public IRubyObject newMethod(IRubyObject receiver, String methodName, boolean bound, Visibility visibility, boolean respondToMissing)
public IRubyObject newMethod(IRubyObject receiver, String methodName, boolean bound, Visibility visibility, boolean respondToMissing, boolean priv)
public IRubyObject define_method(ThreadContext context, IRubyObject arg0, Block block)
public IRubyObject define_method(ThreadContext context, IRubyObject arg0, IRubyObject arg1, Block block)
@Deprecated public IRubyObject define_method(ThreadContext context, IRubyObject[] args, Block block)
@Deprecated public IRubyObject executeUnder(ThreadContext context, Callback method, IRubyObject[] args, Block block)
public IRubyObject name()
public IRubyObject name19()
protected IRubyObject cloneMethods(RubyModule clone)
public IRubyObject initialize_copy(IRubyObject original)
initialize_copy
in class RubyBasicObject
public void syncConstants(RubyModule other)
public void syncClassVariables(RubyModule other)
public RubyArray included_modules(ThreadContext context)
public RubyArray ancestors(ThreadContext context)
@Deprecated public RubyArray ancestors()
public List<IRubyObject> getAncestorList()
public boolean hasModuleInHierarchy(RubyModule type)
public int hashCode()
RubyObject
hashCode
in class RubyObject
public RubyFixnum hash()
RubyBasicObject
hash
in class RubyBasicObject
public IRubyObject to_s()
to_s
in class RubyBasicObject
public RubyBoolean op_eqq(ThreadContext context, IRubyObject obj)
op_eqq
in interface IRubyObject
op_eqq
in class RubyObject
public boolean equals(Object other)
equals
in class RubyObject
other
- The object to check for equalitypublic IRubyObject op_equal(ThreadContext context, IRubyObject other)
op_equal
in interface IRubyObject
op_equal
in class RubyBasicObject
public final IRubyObject freeze(ThreadContext context)
freeze
in class RubyBasicObject
public IRubyObject op_le(IRubyObject obj)
public IRubyObject op_lt(IRubyObject obj)
public IRubyObject op_ge(IRubyObject obj)
public IRubyObject op_gt(IRubyObject obj)
public IRubyObject op_cmp(IRubyObject obj)
public boolean isKindOfModule(RubyModule type)
protected boolean isSame(RubyModule module)
public IRubyObject initialize(ThreadContext context, Block block)
public void addReadWriteAttribute(ThreadContext context, String name)
public void addReadAttribute(ThreadContext context, String name)
public void addWriteAttribute(ThreadContext context, String name)
public IRubyObject attr(ThreadContext context, IRubyObject[] args)
public IRubyObject attr19(ThreadContext context, IRubyObject[] args)
@Deprecated public IRubyObject attr_reader(IRubyObject[] args)
public IRubyObject attr_reader(ThreadContext context, IRubyObject[] args)
public IRubyObject attr_writer(ThreadContext context, IRubyObject[] args)
@Deprecated public IRubyObject attr_accessor(IRubyObject[] args)
public IRubyObject attr_accessor(ThreadContext context, IRubyObject[] args)
public void populateInstanceMethodNames(Set<String> seen, RubyArray ary, Visibility visibility, boolean not, boolean useSymbols, boolean includeSuper)
public RubyArray instance_methods(IRubyObject[] args)
public RubyArray instance_methods19(IRubyObject[] args)
public RubyArray public_instance_methods(IRubyObject[] args)
public RubyArray public_instance_methods19(IRubyObject[] args)
public IRubyObject instance_method(IRubyObject symbol)
public RubyArray protected_instance_methods(IRubyObject[] args)
public RubyArray protected_instance_methods19(IRubyObject[] args)
public RubyArray private_instance_methods(IRubyObject[] args)
public RubyArray private_instance_methods19(IRubyObject[] args)
public RubyModule append_features(IRubyObject module)
public IRubyObject extend_object(IRubyObject obj)
public RubyModule include(IRubyObject[] modules)
public IRubyObject included(ThreadContext context, IRubyObject other)
public IRubyObject extended(ThreadContext context, IRubyObject other, Block block)
public IRubyObject mix(ThreadContext context, IRubyObject mod)
public IRubyObject mix(ThreadContext context, IRubyObject mod, IRubyObject hash0)
public RubyModule rbPublic(ThreadContext context, IRubyObject[] args)
public RubyModule rbProtected(ThreadContext context, IRubyObject[] args)
public RubyModule rbPrivate(ThreadContext context, IRubyObject[] args)
public RubyModule module_function(ThreadContext context, IRubyObject[] args)
public IRubyObject method_added(ThreadContext context, IRubyObject nothing)
public IRubyObject method_removed(ThreadContext context, IRubyObject nothing)
public IRubyObject method_undefined(ThreadContext context, IRubyObject nothing)
public RubyBoolean method_defined_p(ThreadContext context, IRubyObject symbol)
public IRubyObject public_method_defined(ThreadContext context, IRubyObject symbol)
public IRubyObject protected_method_defined(ThreadContext context, IRubyObject symbol)
public IRubyObject private_method_defined(ThreadContext context, IRubyObject symbol)
public RubyModule public_class_method(IRubyObject[] args)
public RubyModule private_class_method(IRubyObject[] args)
public RubyModule alias_method(ThreadContext context, IRubyObject newId, IRubyObject oldId)
public RubyModule undef_method(ThreadContext context, IRubyObject[] args)
public IRubyObject module_eval(ThreadContext context, Block block)
public IRubyObject module_eval(ThreadContext context, IRubyObject arg0, Block block)
public IRubyObject module_eval(ThreadContext context, IRubyObject arg0, IRubyObject arg1, Block block)
public IRubyObject module_eval(ThreadContext context, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, Block block)
@Deprecated public IRubyObject module_eval(ThreadContext context, IRubyObject[] args, Block block)
public IRubyObject module_exec(ThreadContext context, Block block)
public IRubyObject module_exec(ThreadContext context, IRubyObject[] args, Block block)
public RubyModule remove_method(ThreadContext context, IRubyObject[] args)
public static void marshalTo(RubyModule module, MarshalStream output) throws IOException
IOException
public static RubyModule unmarshalFrom(UnmarshalStream input) throws IOException
IOException
public static RubyArray nesting(ThreadContext context, IRubyObject recv, Block block)
public IRubyObject class_variable_defined_p(ThreadContext context, IRubyObject var)
public IRubyObject class_variable_get(IRubyObject var)
public IRubyObject class_variable_get19(IRubyObject var)
public IRubyObject class_variable_set(IRubyObject var, IRubyObject value)
public IRubyObject class_variable_set19(IRubyObject var, IRubyObject value)
public IRubyObject remove_class_variable(ThreadContext context, IRubyObject name)
public IRubyObject remove_class_variable19(ThreadContext context, IRubyObject name)
public RubyArray class_variables(ThreadContext context)
public RubyArray class_variables19(ThreadContext context)
public RubyBoolean const_defined_p(ThreadContext context, IRubyObject symbol)
public RubyBoolean const_defined_p19(ThreadContext context, IRubyObject[] args)
public IRubyObject const_get(IRubyObject symbol)
public IRubyObject const_get_1_9(ThreadContext context, IRubyObject[] args)
public IRubyObject const_get_2_0(ThreadContext context, IRubyObject[] args)
public IRubyObject const_set(IRubyObject symbol, IRubyObject value)
public IRubyObject remove_const(ThreadContext context, IRubyObject rubyName)
public IRubyObject const_missing(ThreadContext context, IRubyObject rubyName, Block block)
rubyName
- The constant name which was found to be missingpublic RubyArray constants(ThreadContext context)
public RubyArray constants19(ThreadContext context)
public RubyArray constants19(ThreadContext context, IRubyObject allConstants)
public RubyArray constantsCommon19(ThreadContext context, boolean replaceModule, boolean allConstants)
public Collection<String> constantsCommon(Ruby runtime, boolean replaceModule, boolean allConstants)
public Collection<String> constantsCommon(Ruby runtime, boolean replaceModule, boolean allConstants, boolean includePrivate)
public IRubyObject private_constant(ThreadContext context, IRubyObject rubyName)
public IRubyObject private_constant(ThreadContext context, IRubyObject[] rubyNames)
public IRubyObject public_constant(ThreadContext context, IRubyObject rubyName)
public IRubyObject public_constant(ThreadContext context, IRubyObject[] rubyNames)
public IRubyObject setClassVar(String name, IRubyObject value)
name
- The variable name to setvalue
- The value to set it to@Deprecated public IRubyObject fastSetClassVar(String internedName, IRubyObject value)
public IRubyObject getClassVar(String name)
name
- The name of the variable to retrieve@Deprecated public IRubyObject fastGetClassVar(String internedName)
public boolean isClassVarDefined(String name)
name
- The class var to determine "is defined?"@Deprecated public boolean fastIsClassVarDefined(String internedName)
@Deprecated public IRubyObject removeCvar(IRubyObject name)
removeClassVariable(String)
public IRubyObject removeClassVariable(String name)
public IRubyObject getConstantAtSpecial(String name)
name
- the constant name to findpublic IRubyObject getConstantAt(String name)
public IRubyObject getConstantAt(String name, boolean includePrivate)
@Deprecated public IRubyObject fastGetConstantAt(String internedName)
public IRubyObject getConstant(String name)
name
- The constant to retrievepublic IRubyObject getConstant(String name, boolean inherit)
public IRubyObject getConstant(String name, boolean inherit, boolean includeObject)
@Deprecated public IRubyObject fastGetConstant(String internedName)
@Deprecated public IRubyObject fastGetConstant(String internedName, boolean inherit)
public IRubyObject getConstantNoConstMissing(String name)
public IRubyObject getConstantNoConstMissing(String name, boolean inherit)
public IRubyObject getConstantNoConstMissing(String name, boolean inherit, boolean includeObject)
public IRubyObject getConstantFrom(String name)
@Deprecated public IRubyObject fastGetConstantFrom(String internedName)
public IRubyObject getConstantFromNoConstMissing(String name)
public IRubyObject getConstantFromNoConstMissing(String name, boolean includePrivate)
@Deprecated public IRubyObject fastGetConstantFromNoConstMissing(String internedName)
public IRubyObject getConstantFromConstMissing(String name)
@Deprecated public IRubyObject fastGetConstantFromConstMissing(String internedName)
public IRubyObject resolveUndefConstant(String name)
public IRubyObject setConstantQuiet(String name, IRubyObject value)
name
- The name to assignvalue
- The value to assign to it; if an unnamed Module, also set its basename to namepublic IRubyObject setConstant(String name, IRubyObject value)
name
- The name to assignvalue
- The value to assign to it; if an unnamed Module, also set its basename to name@Deprecated public IRubyObject fastSetConstant(String internedName, IRubyObject value)
public void defineConstant(String name, IRubyObject value)
public boolean isConstantDefined(String name)
public boolean fastIsConstantDefined(String internedName)
public boolean fastIsConstantDefined19(String internedName)
public boolean fastIsConstantDefined19(String internedName, boolean inherit)
public boolean hasInternalModuleVariable(String name)
getClassVar(String)
. Searches this
class/module and its ancestors for the specified internal
variable.name
- the internal variable namesetInternalModuleVariable(String, IRubyObject)
public IRubyObject searchInternalModuleVariable(String name)
getClassVar(String)
. Searches this
class/module and its ancestors for the specified internal
variable.name
- the internal variable namesetInternalModuleVariable(String, IRubyObject)
public void setInternalModuleVariable(String name, IRubyObject value)
setClassVar(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.name
- the internal variable namevalue
- the internal variable valuesearchInternalModuleVariable(String)
protected Map<String,IRubyObject> getClassVariables()
protected Map<String,IRubyObject> getClassVariablesForRead()
public boolean hasClassVariable(String name)
@Deprecated public boolean fastHasClassVariable(String internedName)
public IRubyObject fetchClassVariable(String name)
@Deprecated public IRubyObject fastFetchClassVariable(String internedName)
public IRubyObject storeClassVariable(String name, IRubyObject value)
@Deprecated public IRubyObject fastStoreClassVariable(String internedName, IRubyObject value)
public IRubyObject deleteClassVariable(String name)
protected final void ensureClassVariablesSettable()
public boolean hasConstant(String name)
@Deprecated public boolean fastHasConstant(String internedName)
public IRubyObject fetchConstant(String name)
public IRubyObject fetchConstant(String name, boolean includePrivate)
@Deprecated public IRubyObject fastFetchConstant(String internedName)
public IRubyObject storeConstant(String name, IRubyObject value)
@Deprecated public IRubyObject fastStoreConstant(String internedName, IRubyObject value)
public IRubyObject deleteConstant(String name)
@Deprecated public List<Variable<IRubyObject>> getStoredConstantList()
@Deprecated public List<String> getStoredConstantNameList()
public Collection<String> getConstantNames()
public Collection<String> getConstantNames(boolean includePrivate)
protected final void ensureConstantsSettable()
protected boolean constantTableContains(String name)
protected IRubyObject constantTableFetch(String name)
protected RubyModule.ConstantEntry constantEntryFetch(String name)
protected IRubyObject constantTableStore(String name, IRubyObject value)
protected IRubyObject constantTableRemove(String name)
protected void defineAutoload(String name, IAutoloadMethod loadMethod)
protected IRubyObject finishAutoload(String name)
public IRubyObject getAutoloadConstant(String name)
@Deprecated public IRubyObject initialize(Block block)
public void setJavaProxy(boolean javaProxy)
public boolean getJavaProxy()
public boolean getCacheProxy()
public void setCacheProxy(boolean cacheProxy)
public void visitInterpretedMethods(NodeVisitor visitor)
visitor
- the visitor to use@Deprecated public void checkMethodBound(ThreadContext context, IRubyObject[] args, Visibility visibility)
@Deprecated public void defineMethod(String name, Callback method)
@Deprecated public void defineFastMethod(String name, Callback method)
@Deprecated public void defineFastMethod(String name, Callback method, Visibility visibility)
@Deprecated public void definePrivateMethod(String name, Callback method)
@Deprecated public void defineFastPrivateMethod(String name, Callback method)
@Deprecated public void defineFastProtectedMethod(String name, Callback method)
@Deprecated public void defineModuleFunction(String name, Callback method)
@Deprecated public void definePublicModuleFunction(String name, Callback method)
@Deprecated public void defineFastModuleFunction(String name, Callback method)
@Deprecated public void defineFastPublicModuleFunction(String name, Callback method)
Copyright © 2001-2014 JRuby. All Rights Reserved.