public class RubyModule extends RubyObject
Modifier and Type | Class and Description |
---|---|
protected static class |
RubyModule.CacheEntryFactory |
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 java.lang.String |
classId |
protected static java.lang.String |
ERR_FROZEN_CONST_TYPE |
protected static java.lang.String |
ERR_FROZEN_CVAR_TYPE |
protected static java.lang.String |
ERR_INSECURE_SET_CLASS_VAR |
protected static java.lang.String |
ERR_INSECURE_SET_CONSTANT |
protected int |
generation |
int |
id |
protected java.util.Set<RubyClass> |
includingHierarchies |
int |
index |
RubyModule.KindOf |
kindOf |
static ObjectAllocator |
MODULE_ALLOCATOR |
protected static RubyModule.CacheEntryFactory |
NormalCacheEntryFactory |
RubyModule |
parent |
static java.util.Set<java.lang.String> |
SCOPE_CAPTURING_METHODS |
protected RubyClass |
superClass |
OBJECT_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, TAINTED_F, UNDEF, UNTRUSTED_F, USER0_F, USER1_F, USER2_F, USER3_F, USER4_F, USER5_F, USER6_F, USER7_F, USER8_F
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(java.lang.String name,
DynamicMethod method) |
void |
addMethodAtBootTimeOnly(java.lang.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(java.lang.String name,
DynamicMethod method) |
void |
addModuleFunction(java.lang.String name,
DynamicMethod method) |
void |
addReadAttribute(ThreadContext context,
java.lang.String name) |
void |
addReadWriteAttribute(ThreadContext context,
java.lang.String name) |
void |
addWriteAttribute(ThreadContext context,
java.lang.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
|
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) |
IRubyObject |
class_variable_defined_p(ThreadContext context,
IRubyObject var) |
IRubyObject |
class_variable_get(IRubyObject var)
rb_mod_cvar_get
|
IRubyObject |
class_variable_set(IRubyObject var,
IRubyObject value)
rb_mod_cvar_set
|
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(IRubyObject symbol)
rb_mod_const_get
|
IRubyObject |
const_get(ThreadContext context,
IRubyObject[] args) |
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
|
RubyArray |
constants(ThreadContext context) |
RubyArray |
constants19(ThreadContext context) |
RubyArray |
constants19(ThreadContext context,
IRubyObject allConstants) |
java.util.Collection<java.lang.String> |
constantsCommon(Ruby runtime,
boolean replaceModule,
boolean allConstants)
rb_mod_constants
|
RubyArray |
constantsCommon19(ThreadContext context,
boolean replaceModule,
boolean allConstants) |
protected boolean |
constantTableContains(java.lang.String name) |
protected boolean |
constantTableFastContains(java.lang.String internedName) |
protected IRubyObject |
constantTableFastFetch(java.lang.String internedName) |
protected IRubyObject |
constantTableFastStore(java.lang.String internedName,
IRubyObject value) |
protected IRubyObject |
constantTableFetch(java.lang.String name) |
protected IRubyObject |
constantTableRemove(java.lang.String name) |
protected IRubyObject |
constantTableStore(java.lang.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(java.lang.String name,
java.lang.String oldName)
rb_alias
|
void |
defineAliases(java.util.List<java.lang.String> aliases,
java.lang.String oldName) |
boolean |
defineAnnotatedConstant(java.lang.reflect.Field field) |
void |
defineAnnotatedConstants(java.lang.Class clazz) |
void |
defineAnnotatedMethod(java.lang.Class clazz,
java.lang.String name) |
boolean |
defineAnnotatedMethod(JavaMethodDescriptor desc,
MethodFactory methodFactory) |
boolean |
defineAnnotatedMethod(java.lang.reflect.Method method,
MethodFactory methodFactory) |
boolean |
defineAnnotatedMethod(java.lang.String name,
java.util.List<JavaMethodDescriptor> methods,
MethodFactory methodFactory) |
void |
defineAnnotatedMethods(java.lang.Class clazz) |
void |
defineAnnotatedMethodsIndividually(java.lang.Class clazz) |
RubyClass |
defineClassUnder(java.lang.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(java.lang.String name,
IRubyObject value)
rb_define_const
|
void |
defineFastMethod(java.lang.String name,
Callback method) |
void |
defineFastMethod(java.lang.String name,
Callback method,
Visibility visibility) |
void |
defineFastModuleFunction(java.lang.String name,
Callback method)
rb_define_module_function
|
void |
defineFastPrivateMethod(java.lang.String name,
Callback method) |
void |
defineFastProtectedMethod(java.lang.String name,
Callback method) |
void |
defineFastPublicModuleFunction(java.lang.String name,
Callback method)
rb_define_module_function
|
void |
defineMethod(java.lang.String name,
Callback method) |
void |
defineModuleFunction(java.lang.String name,
Callback method)
rb_define_module_function
|
RubyModule |
defineModuleUnder(java.lang.String name)
rb_define_module_under
this method should be used only as an API to define/open nested module
|
RubyClass |
defineOrGetClassUnder(java.lang.String name,
RubyClass superClazz)
this method should be used only by interpreter or compiler
|
RubyModule |
defineOrGetModuleUnder(java.lang.String name)
this method should be used only by interpreter or compiler
|
void |
definePrivateMethod(java.lang.String name,
Callback method) |
void |
definePublicModuleFunction(java.lang.String name,
Callback method)
rb_define_module_function
|
IRubyObject |
deleteClassVariable(java.lang.String name) |
IRubyObject |
deleteConstant(java.lang.String name) |
protected void |
ensureClassVariablesSettable() |
protected void |
ensureConstantsSettable() |
boolean |
equals(java.lang.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(java.lang.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(java.lang.String internedName) |
IRubyObject |
fastFetchConstant(java.lang.String internedName) |
RubyClass |
fastGetClass(java.lang.String internedName) |
IRubyObject |
fastGetClassVar(java.lang.String internedName) |
IRubyObject |
fastGetConstant(java.lang.String internedName) |
IRubyObject |
fastGetConstant(java.lang.String internedName,
boolean inherit) |
IRubyObject |
fastGetConstantAt(java.lang.String internedName) |
IRubyObject |
fastGetConstantFrom(java.lang.String internedName) |
IRubyObject |
fastGetConstantFromConstMissing(java.lang.String internedName) |
IRubyObject |
fastGetConstantFromNoConstMissing(java.lang.String internedName) |
boolean |
fastHasClassVariable(java.lang.String internedName) |
boolean |
fastHasConstant(java.lang.String internedName) |
boolean |
fastIsClassVarDefined(java.lang.String internedName) |
boolean |
fastIsConstantDefined(java.lang.String internedName) |
boolean |
fastIsConstantDefined19(java.lang.String internedName) |
boolean |
fastIsConstantDefined19(java.lang.String internedName,
boolean inherit) |
IRubyObject |
fastSetClassVar(java.lang.String internedName,
IRubyObject value) |
IRubyObject |
fastSetConstant(java.lang.String internedName,
IRubyObject value) |
IRubyObject |
fastStoreClassVariable(java.lang.String internedName,
IRubyObject value) |
IRubyObject |
fastStoreConstant(java.lang.String internedName,
IRubyObject value) |
IRubyObject |
fetchClassVariable(java.lang.String name) |
IRubyObject |
fetchConstant(java.lang.String name) |
RubyModule |
findImplementer(RubyModule clazz)
Search through this module and supermodules for method definitions.
|
IRubyObject |
freeze(ThreadContext context)
rb_mod_freeze
|
java.util.List<IRubyObject> |
getAncestorList() |
java.lang.String |
getBaseName() |
int |
getCacheToken() |
RubyClass |
getClass(java.lang.String name)
Finds a class that is within the current module (or class).
|
IRubyObject |
getClassVar(java.lang.String name)
Retrieve the specified class variable, searching through this module, included modules, and supermodules.
|
java.util.List<java.lang.String> |
getClassVariableNameList() |
protected java.util.Map<java.lang.String,IRubyObject> |
getClassVariables() |
protected java.util.Map<java.lang.String,IRubyObject> |
getClassVariablesForRead() |
IRubyObject |
getConstant(java.lang.String name)
Retrieve the named constant, invoking 'const_missing' should that be appropriate.
|
IRubyObject |
getConstant(java.lang.String name,
boolean inherit) |
IRubyObject |
getConstantAt(java.lang.String name) |
IRubyObject |
getConstantAtSpecial(java.lang.String name)
This version searches superclasses if we're starting with Object.
|
IRubyObject |
getConstantFrom(java.lang.String name) |
protected IRubyObject |
getConstantInner(java.lang.String name) |
java.util.Map<java.lang.String,IRubyObject> |
getConstantMap() |
java.util.Map<java.lang.String,IRubyObject> |
getConstantMapForWrite() |
java.util.Collection<java.lang.String> |
getConstantNames() |
IRubyObject |
getConstantNoConstMissing(java.lang.String name) |
IRubyObject |
getConstantNoConstMissing(java.lang.String name,
boolean inherit) |
java.util.Map<java.lang.String,DynamicMethod> |
getMethods() |
java.util.Map<java.lang.String,DynamicMethod> |
getMethodsForWrite() |
java.lang.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() |
java.util.List<Variable<IRubyObject>> |
getStoredConstantList()
Deprecated.
|
java.util.List<java.lang.String> |
getStoredConstantNameList()
Deprecated.
|
RubyClass |
getSuperClass()
Getter for property superClass.
|
boolean |
hasClassVariable(java.lang.String name) |
boolean |
hasConstant(java.lang.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(java.lang.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)
rb_mod_initialize
|
IRubyObject |
initialize19(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() |
protected void |
invalidateConstantCache() |
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(java.lang.String name)
Is class var defined?
Ruby C equivalent = "rb_cvar_defined"
|
boolean |
isConstantDefined(java.lang.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(java.lang.String name,
boolean checkVisibility)
MRI: rb_method_boundp
|
boolean |
isMethodBound(java.lang.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 |
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,
java.lang.String methodName,
boolean bound,
Visibility visibility) |
IRubyObject |
newMethod(IRubyObject receiver,
java.lang.String methodName,
boolean bound,
Visibility visibility,
boolean respondToMissing) |
IRubyObject |
newMethod(IRubyObject receiver,
java.lang.String methodName,
boolean bound,
Visibility visibility,
boolean respondToMissing,
boolean priv) |
static RubyModule |
newModule(Ruby runtime)
rb_module_new
|
static RubyModule |
newModule(Ruby runtime,
java.lang.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(java.util.Set<java.lang.String> seen,
RubyArray ary,
Visibility visibility,
boolean not,
boolean useSymbols,
boolean includeSuper) |
RubyModule |
private_class_method(IRubyObject[] args) |
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) |
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_const(ThreadContext context,
IRubyObject rubyName) |
RubyModule |
remove_method(ThreadContext context,
IRubyObject[] args) |
void |
removeClassProvider(ClassProvider provider) |
IRubyObject |
removeClassVariable(java.lang.String name) |
IRubyObject |
removeCvar(IRubyObject name)
Deprecated.
|
void |
removeMethod(ThreadContext context,
java.lang.String name) |
IRubyObject |
resolveUndefConstant(Ruby runtime,
java.lang.String name) |
DynamicMethod |
retrieveMethod(java.lang.String name)
Search through this module and supermodules for method definitions.
|
IRubyObject |
searchInternalModuleVariable(java.lang.String name)
Behaves similarly to
getClassVar(String) . |
DynamicMethod |
searchMethod(java.lang.String name)
Search through this module and supermodules for method definitions.
|
protected DynamicMethod |
searchMethodInner(java.lang.String name) |
CacheEntry |
searchWithCache(java.lang.String name)
Search through this module and supermodules for method definitions.
|
void |
setBaseName(java.lang.String name) |
IRubyObject |
setClassVar(java.lang.String name,
IRubyObject value)
Set the named class variable to the given value, provided taint and freeze allow setting it.
|
IRubyObject |
setConstant(java.lang.String name,
IRubyObject value)
Set the named constant on this module.
|
IRubyObject |
setConstantQuiet(java.lang.String name,
IRubyObject value)
Set the named constant on this module.
|
void |
setInternalModuleVariable(java.lang.String name,
IRubyObject value)
Behaves similarly to
setClassVar(String, IRubyObject) . |
void |
setMethodVisibility(IRubyObject[] methods,
Visibility visibility)
set_method_visibility
|
void |
setParent(RubyModule parent) |
protected void |
setSuperClass(RubyClass superClass) |
IRubyObject |
storeClassVariable(java.lang.String name,
IRubyObject value) |
IRubyObject |
storeConstant(java.lang.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,
java.lang.String name)
rb_undef
|
void |
undefineMethod(java.lang.String name) |
static RubyModule |
unmarshalFrom(UnmarshalStream input) |
protected java.lang.String |
validateClassVariable(java.lang.String name) |
protected java.lang.String |
validateConstant(java.lang.String name) |
attachToObjectSpace, callInit, callInit, callInit, callInit, callInit, convertToType, createObjectClass, eqlInternal, equalInternal, initialize, 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, getFlag, getInstanceEvalClass, getInstanceVariable, getInstanceVariableList, getInstanceVariableNameList, getInstanceVariables, getInternalVariable, getInternalVariables, getJavaClass, getMetaClass, getObjectId, getRuntime, getSingletonClass, getSingletonClassClone, getType, getVariable, getVariableCount, getVariableList, getVariableNameList, hashyInspect, hasInstanceVariable, hasInternalVariable, hasVariables, id_deprecated, id, infectBy, initialize19, initialize19, initialize19, initialize19, initialize19, initObjectId, 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, send19, setFlag, setFrozen, setInstanceVariable, setInternalVariable, setMetaClass, 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 java.lang.String ERR_INSECURE_SET_CONSTANT
protected static final java.lang.String ERR_FROZEN_CONST_TYPE
public static final java.util.Set<java.lang.String> SCOPE_CAPTURING_METHODS
public static final ObjectAllocator MODULE_ALLOCATOR
protected static final RubyModule.CacheEntryFactory NormalCacheEntryFactory
protected static final java.lang.String ERR_INSECURE_SET_CLASS_VAR
protected static final java.lang.String ERR_FROZEN_CVAR_TYPE
public RubyModule.KindOf kindOf
public final int id
public RubyModule parent
protected java.lang.String classId
protected int generation
protected volatile java.util.Set<RubyClass> includingHierarchies
protected RubyClass superClass
public int index
protected RubyModule(Ruby runtime, RubyClass metaClass, boolean objectSpace)
protected RubyModule(Ruby runtime, RubyClass metaClass)
protected RubyModule(Ruby runtime)
public int getNativeTypeIndex()
RubyObject
getNativeTypeIndex
in interface CoreObjectType
getNativeTypeIndex
in class RubyObject
org.jruby.runtime.ClassInde
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 java.util.Map<java.lang.String,IRubyObject> getConstantMap()
public java.util.Map<java.lang.String,IRubyObject> getConstantMapForWrite()
public void addIncludingHierarchy(IncludedModuleWrapper hierarchy)
public boolean needsImplementer()
public static RubyModule newModule(Ruby runtime)
public static RubyModule newModule(Ruby runtime, java.lang.String name, RubyModule parent, boolean setParent)
public void addClassProvider(ClassProvider provider)
public void removeClassProvider(ClassProvider provider)
public RubyClass getSuperClass()
protected void setSuperClass(RubyClass superClass)
public RubyModule getParent()
public void setParent(RubyModule parent)
public java.util.Map<java.lang.String,DynamicMethod> getMethods()
public java.util.Map<java.lang.String,DynamicMethod> getMethodsForWrite()
public boolean isIncluded()
public RubyModule getNonIncludedClass()
public java.lang.String getBaseName()
public void setBaseName(java.lang.String name)
public java.lang.String getName()
@Deprecated public IncludedModuleWrapper newIncludeClass(RubyClass superClazz)
public RubyClass getClass(java.lang.String name)
name
- to be found in this module (or class)public RubyClass fastGetClass(java.lang.String internedName)
public void includeModule(IRubyObject arg)
arg
- The module to includepublic void defineMethod(java.lang.String name, Callback method)
public void defineAnnotatedMethod(java.lang.Class clazz, java.lang.String name)
public void defineAnnotatedConstants(java.lang.Class clazz)
public boolean defineAnnotatedConstant(java.lang.reflect.Field field)
public void defineAnnotatedMethods(java.lang.Class clazz)
public void defineAnnotatedMethodsIndividually(java.lang.Class clazz)
public boolean defineAnnotatedMethod(java.lang.String name, java.util.List<JavaMethodDescriptor> methods, MethodFactory methodFactory)
public boolean defineAnnotatedMethod(java.lang.reflect.Method method, MethodFactory methodFactory)
public boolean defineAnnotatedMethod(JavaMethodDescriptor desc, MethodFactory methodFactory)
public void defineFastMethod(java.lang.String name, Callback method)
public void defineFastMethod(java.lang.String name, Callback method, Visibility visibility)
public void definePrivateMethod(java.lang.String name, Callback method)
public void defineFastPrivateMethod(java.lang.String name, Callback method)
public void defineFastProtectedMethod(java.lang.String name, Callback method)
public void undefineMethod(java.lang.String name)
public void undef(ThreadContext context, java.lang.String name)
public IRubyObject include_p(ThreadContext context, IRubyObject arg)
public void addMethod(java.lang.String name, DynamicMethod method)
public void addMethodInternal(java.lang.String name, DynamicMethod method)
public void addMethodAtBootTimeOnly(java.lang.String name, DynamicMethod method)
name
- The name to which to bind the methodmethod
- The method to bindpublic void removeMethod(ThreadContext context, java.lang.String name)
public DynamicMethod searchMethod(java.lang.String name)
name
- The name of the method to search forpublic CacheEntry searchWithCache(java.lang.String name)
name
- The name of the method to search forpublic final int getCacheToken()
public void becomeSynchronized()
public boolean isSynchronized()
protected DynamicMethod searchMethodInner(java.lang.String name)
public void invalidateCacheDescendants()
protected void invalidateCoreClasses()
protected void invalidateCacheDescendantsInner()
protected void invalidateConstantCache()
public DynamicMethod retrieveMethod(java.lang.String name)
name
- The name of the method to search forpublic RubyModule findImplementer(RubyModule clazz)
name
- The name of the method to search forpublic void addModuleFunction(java.lang.String name, DynamicMethod method)
public void defineModuleFunction(java.lang.String name, Callback method)
public void definePublicModuleFunction(java.lang.String name, Callback method)
public void defineFastModuleFunction(java.lang.String name, Callback method)
public void defineFastPublicModuleFunction(java.lang.String name, Callback method)
public void defineAlias(java.lang.String name, java.lang.String oldName)
public void defineAliases(java.util.List<java.lang.String> aliases, java.lang.String oldName)
public RubyClass defineOrGetClassUnder(java.lang.String name, RubyClass superClazz)
public RubyModule defineOrGetModuleUnder(java.lang.String name)
public RubyClass defineClassUnder(java.lang.String name, RubyClass superClass, ObjectAllocator allocator)
public RubyModule defineModuleUnder(java.lang.String name)
public void setMethodVisibility(IRubyObject[] methods, Visibility visibility)
public void exportMethod(java.lang.String name, Visibility visibility)
public boolean isMethodBound(java.lang.String name, boolean checkVisibility)
public boolean isMethodBound(java.lang.String name, boolean checkVisibility, boolean checkRespondTo)
public void checkMethodBound(ThreadContext context, IRubyObject[] args, Visibility visibility)
public IRubyObject newMethod(IRubyObject receiver, java.lang.String methodName, boolean bound, Visibility visibility)
public IRubyObject newMethod(IRubyObject receiver, java.lang.String methodName, boolean bound, Visibility visibility, boolean respondToMissing)
public IRubyObject newMethod(IRubyObject receiver, java.lang.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 java.util.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(java.lang.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(Block block)
public IRubyObject initialize19(ThreadContext context, Block block)
public void addReadWriteAttribute(ThreadContext context, java.lang.String name)
public void addReadAttribute(ThreadContext context, java.lang.String name)
public void addWriteAttribute(ThreadContext context, java.lang.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(java.util.Set<java.lang.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 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 java.io.IOException
java.io.IOException
public static RubyModule unmarshalFrom(UnmarshalStream input) throws java.io.IOException
java.io.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_set(IRubyObject var, IRubyObject value)
public IRubyObject remove_class_variable(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(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)
name
- 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 java.util.Collection<java.lang.String> constantsCommon(Ruby runtime, boolean replaceModule, boolean allConstants)
public IRubyObject setClassVar(java.lang.String name, IRubyObject value)
name
- The variable name to setvalue
- The value to set it topublic IRubyObject fastSetClassVar(java.lang.String internedName, IRubyObject value)
public IRubyObject getClassVar(java.lang.String name)
name
- The name of the variable to retrievepublic IRubyObject fastGetClassVar(java.lang.String internedName)
public boolean isClassVarDefined(java.lang.String name)
name
- The class var to determine "is defined?"public boolean fastIsClassVarDefined(java.lang.String internedName)
@Deprecated public IRubyObject removeCvar(IRubyObject name)
removeClassVariable(String)
public IRubyObject removeClassVariable(java.lang.String name)
public IRubyObject getConstantAtSpecial(java.lang.String name)
name
- the constant name to findpublic IRubyObject getConstantAt(java.lang.String name)
public IRubyObject fastGetConstantAt(java.lang.String internedName)
public IRubyObject getConstant(java.lang.String name)
name
- The constant to retrievepublic IRubyObject getConstant(java.lang.String name, boolean inherit)
public IRubyObject fastGetConstant(java.lang.String internedName)
public IRubyObject fastGetConstant(java.lang.String internedName, boolean inherit)
public IRubyObject getConstantNoConstMissing(java.lang.String name)
public IRubyObject getConstantNoConstMissing(java.lang.String name, boolean inherit)
protected IRubyObject getConstantInner(java.lang.String name)
public IRubyObject getConstantFrom(java.lang.String name)
public IRubyObject fastGetConstantFrom(java.lang.String internedName)
public IRubyObject fastGetConstantFromNoConstMissing(java.lang.String internedName)
public IRubyObject fastGetConstantFromConstMissing(java.lang.String internedName)
public IRubyObject resolveUndefConstant(Ruby runtime, java.lang.String name)
public IRubyObject setConstantQuiet(java.lang.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(java.lang.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 fastSetConstant(java.lang.String internedName, IRubyObject value)
public void defineConstant(java.lang.String name, IRubyObject value)
public boolean isConstantDefined(java.lang.String name)
public boolean fastIsConstantDefined(java.lang.String internedName)
public boolean fastIsConstantDefined19(java.lang.String internedName)
public boolean fastIsConstantDefined19(java.lang.String internedName, boolean inherit)
public boolean hasInternalModuleVariable(java.lang.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(java.lang.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(java.lang.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 java.util.Map<java.lang.String,IRubyObject> getClassVariables()
protected java.util.Map<java.lang.String,IRubyObject> getClassVariablesForRead()
public boolean hasClassVariable(java.lang.String name)
public boolean fastHasClassVariable(java.lang.String internedName)
public IRubyObject fetchClassVariable(java.lang.String name)
public IRubyObject fastFetchClassVariable(java.lang.String internedName)
public IRubyObject storeClassVariable(java.lang.String name, IRubyObject value)
public IRubyObject fastStoreClassVariable(java.lang.String internedName, IRubyObject value)
public IRubyObject deleteClassVariable(java.lang.String name)
public java.util.List<java.lang.String> getClassVariableNameList()
protected final java.lang.String validateClassVariable(java.lang.String name)
protected final void ensureClassVariablesSettable()
public boolean hasConstant(java.lang.String name)
public boolean fastHasConstant(java.lang.String internedName)
public IRubyObject fetchConstant(java.lang.String name)
public IRubyObject fastFetchConstant(java.lang.String internedName)
public IRubyObject storeConstant(java.lang.String name, IRubyObject value)
public IRubyObject fastStoreConstant(java.lang.String internedName, IRubyObject value)
public IRubyObject deleteConstant(java.lang.String name)
@Deprecated public java.util.List<Variable<IRubyObject>> getStoredConstantList()
@Deprecated public java.util.List<java.lang.String> getStoredConstantNameList()
public java.util.Collection<java.lang.String> getConstantNames()
protected final java.lang.String validateConstant(java.lang.String name)
protected final void ensureConstantsSettable()
protected boolean constantTableContains(java.lang.String name)
protected boolean constantTableFastContains(java.lang.String internedName)
protected IRubyObject constantTableFetch(java.lang.String name)
protected IRubyObject constantTableFastFetch(java.lang.String internedName)
protected IRubyObject constantTableStore(java.lang.String name, IRubyObject value)
protected IRubyObject constantTableFastStore(java.lang.String internedName, IRubyObject value)
protected IRubyObject constantTableRemove(java.lang.String name)
Copyright © 2002-2009 JRuby Team. All Rights Reserved.