org.jruby
Class RubyModule

java.lang.Object
  extended by org.jruby.RubyBasicObject
      extended by org.jruby.RubyObject
          extended by org.jruby.RubyModule
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<IRubyObject>, InstanceVariables, InternalVariables, IRubyObject, CoreObjectType
Direct Known Subclasses:
RubyClass

public class RubyModule
extends RubyObject

Author:
jpetersen
See Also:
Serialized Form

Nested Class Summary
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.
 
Nested classes/interfaces inherited from class org.jruby.RubyObject
RubyObject.Data
 
Nested classes/interfaces inherited from class org.jruby.RubyBasicObject
RubyBasicObject.Finalizer
 
Field Summary
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
           
 
Fields inherited from class org.jruby.RubyObject
OBJECT_ALLOCATOR, REIFYING_OBJECT_ALLOCATOR
 
Fields inherited from class org.jruby.RubyBasicObject
ALL_F, BASICOBJECT_ALLOCATOR, COMPARE_BY_IDENTITY_F, ERR_INSECURE_SET_INST_VAR, FALSE_F, FL_USHIFT, flags, FROZEN_F, metaClass, NEVER, NIL_F, TAINTED_F, UNDEF, UNTRUSTED_F, USER0_F, USER1_F, USER2_F, USER3_F, USER4_F, USER5_F, USER6_F, USER7_F, USER8_F
 
Fields inherited from interface org.jruby.runtime.builtin.IRubyObject
NULL_ARRAY
 
Constructor Summary
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
 
Method Summary
 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. - use removeClassVariable(String)
 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)
           
 
Methods inherited from class org.jruby.RubyObject
attachToObjectSpace, callInit, callInit, callInit, callInit, callInit, convertToType, createObjectClass, eqlInternal, equalInternal, initialize, puts, specificEval, toString
 
Methods inherited from class org.jruby.RubyBasicObject
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
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ERR_INSECURE_SET_CONSTANT

protected static final java.lang.String ERR_INSECURE_SET_CONSTANT
See Also:
Constant Field Values

ERR_FROZEN_CONST_TYPE

protected static final java.lang.String ERR_FROZEN_CONST_TYPE
See Also:
Constant Field Values

SCOPE_CAPTURING_METHODS

public static final java.util.Set<java.lang.String> SCOPE_CAPTURING_METHODS

MODULE_ALLOCATOR

public static final ObjectAllocator MODULE_ALLOCATOR

NormalCacheEntryFactory

protected static final RubyModule.CacheEntryFactory NormalCacheEntryFactory

ERR_INSECURE_SET_CLASS_VAR

protected static final java.lang.String ERR_INSECURE_SET_CLASS_VAR
See Also:
Constant Field Values

ERR_FROZEN_CVAR_TYPE

protected static final java.lang.String ERR_FROZEN_CVAR_TYPE
See Also:
Constant Field Values

kindOf

public RubyModule.KindOf kindOf

id

public final int id

parent

public RubyModule parent

classId

protected java.lang.String classId

generation

protected int generation

includingHierarchies

protected volatile java.util.Set<RubyClass> includingHierarchies

superClass

protected RubyClass superClass

index

public int index
Constructor Detail

RubyModule

protected RubyModule(Ruby runtime,
                     RubyClass metaClass,
                     boolean objectSpace)
separate path for MetaClass construction


RubyModule

protected RubyModule(Ruby runtime,
                     RubyClass metaClass)
used by MODULE_ALLOCATOR and RubyClass constructors


RubyModule

protected RubyModule(Ruby runtime)
standard path for Module construction

Method Detail

createModuleClass

public static RubyClass createModuleClass(Ruby runtime,
                                          RubyClass moduleClass)

getNativeTypeIndex

public int getNativeTypeIndex()
Description copied from class: RubyObject
This is overridden in the other concrete Java builtins to provide a fast way to determine what type they are. Will generally return a value from org.jruby.runtime.ClassIndex

Specified by:
getNativeTypeIndex in interface CoreObjectType
Overrides:
getNativeTypeIndex in class RubyObject
Returns:
the ClassIndex of the native type this object was constructed from
See Also:
org.jruby.runtime.ClassInde

isModule

public boolean isModule()
Description copied from class: RubyBasicObject
Specifically polymorphic method that are meant to be overridden by modules to specify that they are modules in an easy way.

Specified by:
isModule in interface IRubyObject
Overrides:
isModule in class RubyBasicObject
Returns:
true if an object is Ruby Module instance (note that it will return false for Ruby Classes). If is_a? semantics is required, use (someObject instanceof RubyModule) instead.

isClass

public boolean isClass()
Description copied from class: RubyBasicObject
Specifically polymorphic method that are meant to be overridden by classes to specify that they are classes in an easy way.

Specified by:
isClass in interface IRubyObject
Overrides:
isClass in class RubyBasicObject
Returns:
true if an object is Ruby Class instance (note that it will return false for Ruby singleton classes). If is_a? semantics is required, use (someObject instanceof RubyClass/MetaClass) instead.

isSingleton

public boolean isSingleton()

isInstance

public boolean isInstance(IRubyObject object)

getConstantMap

public java.util.Map<java.lang.String,IRubyObject> getConstantMap()

getConstantMapForWrite

public java.util.Map<java.lang.String,IRubyObject> getConstantMapForWrite()

addIncludingHierarchy

public void addIncludingHierarchy(IncludedModuleWrapper hierarchy)

needsImplementer

public boolean needsImplementer()

newModule

public static RubyModule newModule(Ruby runtime)
rb_module_new


newModule

public 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


addClassProvider

public void addClassProvider(ClassProvider provider)

removeClassProvider

public void removeClassProvider(ClassProvider provider)

getSuperClass

public RubyClass getSuperClass()
Getter for property superClass.

Returns:
Value of property superClass.

setSuperClass

protected void setSuperClass(RubyClass superClass)

getParent

public RubyModule getParent()

setParent

public void setParent(RubyModule parent)

getMethods

public java.util.Map<java.lang.String,DynamicMethod> getMethods()

getMethodsForWrite

public java.util.Map<java.lang.String,DynamicMethod> getMethodsForWrite()

isIncluded

public boolean isIncluded()
Is this module one that in an included one (e.g. an IncludedModuleWrapper).


getNonIncludedClass

public RubyModule getNonIncludedClass()

getBaseName

public java.lang.String getBaseName()

setBaseName

public void setBaseName(java.lang.String name)

getName

public java.lang.String getName()
Generate a fully-qualified class name or a #-style name for anonymous and singleton classes. Ruby C equivalent = "classname"

Returns:
The generated class name

newIncludeClass

@Deprecated
public IncludedModuleWrapper newIncludeClass(RubyClass superClazz)
Deprecated. 

Create a wrapper to use for including the specified module into this one. Ruby C equivalent = "include_class_new"

Returns:
The module wrapper

getClass

public RubyClass getClass(java.lang.String name)
Finds a class that is within the current module (or class).

Parameters:
name - to be found in this module (or class)
Returns:
the class or null if no such class

fastGetClass

public RubyClass fastGetClass(java.lang.String internedName)

includeModule

public void includeModule(IRubyObject arg)
Include a new module in this module or class.

Parameters:
arg - The module to include

defineMethod

public void defineMethod(java.lang.String name,
                         Callback method)

defineAnnotatedMethod

public void defineAnnotatedMethod(java.lang.Class clazz,
                                  java.lang.String name)

defineAnnotatedConstants

public void defineAnnotatedConstants(java.lang.Class clazz)

defineAnnotatedConstant

public boolean defineAnnotatedConstant(java.lang.reflect.Field field)

defineAnnotatedMethods

public void defineAnnotatedMethods(java.lang.Class clazz)

defineAnnotatedMethodsIndividually

public void defineAnnotatedMethodsIndividually(java.lang.Class clazz)

defineAnnotatedMethod

public boolean defineAnnotatedMethod(java.lang.String name,
                                     java.util.List<JavaMethodDescriptor> methods,
                                     MethodFactory methodFactory)

defineAnnotatedMethod

public boolean defineAnnotatedMethod(java.lang.reflect.Method method,
                                     MethodFactory methodFactory)

defineAnnotatedMethod

public boolean defineAnnotatedMethod(JavaMethodDescriptor desc,
                                     MethodFactory methodFactory)

defineFastMethod

public void defineFastMethod(java.lang.String name,
                             Callback method)

defineFastMethod

public void defineFastMethod(java.lang.String name,
                             Callback method,
                             Visibility visibility)

definePrivateMethod

public void definePrivateMethod(java.lang.String name,
                                Callback method)

defineFastPrivateMethod

public void defineFastPrivateMethod(java.lang.String name,
                                    Callback method)

defineFastProtectedMethod

public void defineFastProtectedMethod(java.lang.String name,
                                      Callback method)

undefineMethod

public void undefineMethod(java.lang.String name)

undef

public void undef(ThreadContext context,
                  java.lang.String name)
rb_undef


include_p

public IRubyObject include_p(ThreadContext context,
                             IRubyObject arg)

addMethod

public void addMethod(java.lang.String name,
                      DynamicMethod method)

addMethodInternal

public void addMethodInternal(java.lang.String name,
                              DynamicMethod method)

addMethodAtBootTimeOnly

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

Parameters:
name - The name to which to bind the method
method - The method to bind

removeMethod

public void removeMethod(ThreadContext context,
                         java.lang.String name)

searchMethod

public DynamicMethod searchMethod(java.lang.String name)
Search through this module and supermodules for method definitions. Cache superclass definitions in this class.

Parameters:
name - The name of the method to search for
Returns:
The method, or UndefinedMethod if not found

searchWithCache

public CacheEntry searchWithCache(java.lang.String name)
Search through this module and supermodules for method definitions. Cache superclass definitions in this class.

Parameters:
name - The name of the method to search for
Returns:
The method, or UndefinedMethod if not found

getCacheToken

public final int getCacheToken()

becomeSynchronized

public void becomeSynchronized()

isSynchronized

public boolean isSynchronized()

searchMethodInner

protected DynamicMethod searchMethodInner(java.lang.String name)

invalidateCacheDescendants

public void invalidateCacheDescendants()

invalidateCoreClasses

protected void invalidateCoreClasses()

invalidateCacheDescendantsInner

protected void invalidateCacheDescendantsInner()

invalidateConstantCache

protected void invalidateConstantCache()

retrieveMethod

public DynamicMethod retrieveMethod(java.lang.String name)
Search through this module and supermodules for method definitions. Cache superclass definitions in this class.

Parameters:
name - The name of the method to search for
Returns:
The method, or UndefinedMethod if not found

findImplementer

public RubyModule findImplementer(RubyModule clazz)
Search through this module and supermodules for method definitions. Cache superclass definitions in this class.

Parameters:
name - The name of the method to search for
Returns:
The method, or UndefinedMethod if not found

addModuleFunction

public void addModuleFunction(java.lang.String name,
                              DynamicMethod method)

defineModuleFunction

public void defineModuleFunction(java.lang.String name,
                                 Callback method)
rb_define_module_function


definePublicModuleFunction

public void definePublicModuleFunction(java.lang.String name,
                                       Callback method)
rb_define_module_function


defineFastModuleFunction

public void defineFastModuleFunction(java.lang.String name,
                                     Callback method)
rb_define_module_function


defineFastPublicModuleFunction

public void defineFastPublicModuleFunction(java.lang.String name,
                                           Callback method)
rb_define_module_function


defineAlias

public void defineAlias(java.lang.String name,
                        java.lang.String oldName)
rb_alias


defineAliases

public void defineAliases(java.util.List<java.lang.String> aliases,
                          java.lang.String oldName)

defineOrGetClassUnder

public RubyClass defineOrGetClassUnder(java.lang.String name,
                                       RubyClass superClazz)
this method should be used only by interpreter or compiler


defineOrGetModuleUnder

public RubyModule defineOrGetModuleUnder(java.lang.String name)
this method should be used only by interpreter or compiler


defineClassUnder

public 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


defineModuleUnder

public RubyModule defineModuleUnder(java.lang.String name)
rb_define_module_under this method should be used only as an API to define/open nested module


setMethodVisibility

public void setMethodVisibility(IRubyObject[] methods,
                                Visibility visibility)
set_method_visibility


exportMethod

public void exportMethod(java.lang.String name,
                         Visibility visibility)
rb_export_method


isMethodBound

public boolean isMethodBound(java.lang.String name,
                             boolean checkVisibility)
MRI: rb_method_boundp


isMethodBound

public boolean isMethodBound(java.lang.String name,
                             boolean checkVisibility,
                             boolean checkRespondTo)

checkMethodBound

public void checkMethodBound(ThreadContext context,
                             IRubyObject[] args,
                             Visibility visibility)

newMethod

public IRubyObject newMethod(IRubyObject receiver,
                             java.lang.String methodName,
                             boolean bound,
                             Visibility visibility)

newMethod

public IRubyObject newMethod(IRubyObject receiver,
                             java.lang.String methodName,
                             boolean bound,
                             Visibility visibility,
                             boolean respondToMissing)

newMethod

public IRubyObject newMethod(IRubyObject receiver,
                             java.lang.String methodName,
                             boolean bound,
                             Visibility visibility,
                             boolean respondToMissing,
                             boolean priv)

define_method

public IRubyObject define_method(ThreadContext context,
                                 IRubyObject arg0,
                                 Block block)

define_method

public IRubyObject define_method(ThreadContext context,
                                 IRubyObject arg0,
                                 IRubyObject arg1,
                                 Block block)

define_method

@Deprecated
public IRubyObject define_method(ThreadContext context,
                                            IRubyObject[] args,
                                            Block block)
Deprecated. 


executeUnder

@Deprecated
public IRubyObject executeUnder(ThreadContext context,
                                           Callback method,
                                           IRubyObject[] args,
                                           Block block)
Deprecated. 


name

public IRubyObject name()

name19

public IRubyObject name19()

cloneMethods

protected IRubyObject cloneMethods(RubyModule clone)

initialize_copy

public IRubyObject initialize_copy(IRubyObject original)
rb_mod_init_copy

Overrides:
initialize_copy in class RubyBasicObject

syncConstants

public void syncConstants(RubyModule other)

syncClassVariables

public void syncClassVariables(RubyModule other)

included_modules

public RubyArray included_modules(ThreadContext context)
rb_mod_included_modules


ancestors

public RubyArray ancestors(ThreadContext context)
rb_mod_ancestors


ancestors

@Deprecated
public RubyArray ancestors()
Deprecated. 


getAncestorList

public java.util.List<IRubyObject> getAncestorList()

hasModuleInHierarchy

public boolean hasModuleInHierarchy(RubyModule type)

hashCode

public int hashCode()
Description copied from class: RubyObject
Override the Object#hashCode method to make sure that the Ruby hash is actually used as the hashcode for Ruby objects. If the Ruby "hash" method doesn't return a number, the Object#hashCode implementation will be used instead.

Overrides:
hashCode in class RubyObject

hash

public RubyFixnum hash()
Description copied from class: RubyBasicObject
rb_obj_id Will return the hash code of this object. In comparison to MRI, this method will use the Java identity hash code instead of using rb_obj_id, since the usage of id in JRuby will incur the cost of some. ObjectSpace maintenance.

Overrides:
hash in class RubyBasicObject

to_s

public IRubyObject to_s()
rb_mod_to_s

Overrides:
to_s in class RubyBasicObject

op_eqq

public RubyBoolean op_eqq(ThreadContext context,
                          IRubyObject obj)
rb_mod_eqq

Specified by:
op_eqq in interface IRubyObject
Overrides:
op_eqq in class RubyObject

equals

public boolean equals(java.lang.Object other)
We override equals here to provide a faster path, since equality for modules is pretty cut and dried.

Overrides:
equals in class RubyObject
Parameters:
other - The object to check for equality
Returns:
true if reference equality, false otherwise

op_equal

public IRubyObject op_equal(ThreadContext context,
                            IRubyObject other)
Specified by:
op_equal in interface IRubyObject
Overrides:
op_equal in class RubyBasicObject

freeze

public final IRubyObject freeze(ThreadContext context)
rb_mod_freeze

Overrides:
freeze in class RubyBasicObject

op_le

public IRubyObject op_le(IRubyObject obj)
rb_mod_le


op_lt

public IRubyObject op_lt(IRubyObject obj)
rb_mod_lt


op_ge

public IRubyObject op_ge(IRubyObject obj)
rb_mod_ge


op_gt

public IRubyObject op_gt(IRubyObject obj)
rb_mod_gt


op_cmp

public IRubyObject op_cmp(IRubyObject obj)
rb_mod_cmp


isKindOfModule

public boolean isKindOfModule(RubyModule type)

isSame

protected boolean isSame(RubyModule module)

initialize

public IRubyObject initialize(Block block)
rb_mod_initialize


initialize19

public IRubyObject initialize19(ThreadContext context,
                                Block block)
rb_mod_initialize


addReadWriteAttribute

public void addReadWriteAttribute(ThreadContext context,
                                  java.lang.String name)

addReadAttribute

public void addReadAttribute(ThreadContext context,
                             java.lang.String name)

addWriteAttribute

public void addWriteAttribute(ThreadContext context,
                              java.lang.String name)

attr

public IRubyObject attr(ThreadContext context,
                        IRubyObject[] args)
rb_mod_attr


attr19

public IRubyObject attr19(ThreadContext context,
                          IRubyObject[] args)

attr_reader

@Deprecated
public IRubyObject attr_reader(IRubyObject[] args)
Deprecated. 


attr_reader

public IRubyObject attr_reader(ThreadContext context,
                               IRubyObject[] args)
rb_mod_attr_reader


attr_writer

public IRubyObject attr_writer(ThreadContext context,
                               IRubyObject[] args)
rb_mod_attr_writer


attr_accessor

@Deprecated
public IRubyObject attr_accessor(IRubyObject[] args)
Deprecated. 


attr_accessor

public IRubyObject attr_accessor(ThreadContext context,
                                 IRubyObject[] args)
rb_mod_attr_accessor


populateInstanceMethodNames

public void populateInstanceMethodNames(java.util.Set<java.lang.String> seen,
                                        RubyArray ary,
                                        Visibility visibility,
                                        boolean not,
                                        boolean useSymbols,
                                        boolean includeSuper)

instance_methods

public RubyArray instance_methods(IRubyObject[] args)

instance_methods19

public RubyArray instance_methods19(IRubyObject[] args)

public_instance_methods

public RubyArray public_instance_methods(IRubyObject[] args)

public_instance_methods19

public RubyArray public_instance_methods19(IRubyObject[] args)

instance_method

public IRubyObject instance_method(IRubyObject symbol)

protected_instance_methods

public RubyArray protected_instance_methods(IRubyObject[] args)
rb_class_protected_instance_methods


protected_instance_methods19

public RubyArray protected_instance_methods19(IRubyObject[] args)

private_instance_methods

public RubyArray private_instance_methods(IRubyObject[] args)
rb_class_private_instance_methods


private_instance_methods19

public RubyArray private_instance_methods19(IRubyObject[] args)

append_features

public RubyModule append_features(IRubyObject module)
rb_mod_append_features


extend_object

public IRubyObject extend_object(IRubyObject obj)
rb_mod_extend_object


include

public RubyModule include(IRubyObject[] modules)
rb_mod_include


included

public IRubyObject included(ThreadContext context,
                            IRubyObject other)

extended

public IRubyObject extended(ThreadContext context,
                            IRubyObject other,
                            Block block)

rbPublic

public RubyModule rbPublic(ThreadContext context,
                           IRubyObject[] args)
rb_mod_public


rbProtected

public RubyModule rbProtected(ThreadContext context,
                              IRubyObject[] args)
rb_mod_protected


rbPrivate

public RubyModule rbPrivate(ThreadContext context,
                            IRubyObject[] args)
rb_mod_private


module_function

public RubyModule module_function(ThreadContext context,
                                  IRubyObject[] args)
rb_mod_modfunc


method_added

public IRubyObject method_added(ThreadContext context,
                                IRubyObject nothing)

method_removed

public IRubyObject method_removed(ThreadContext context,
                                  IRubyObject nothing)

method_undefined

public IRubyObject method_undefined(ThreadContext context,
                                    IRubyObject nothing)

method_defined_p

public RubyBoolean method_defined_p(ThreadContext context,
                                    IRubyObject symbol)

public_method_defined

public IRubyObject public_method_defined(ThreadContext context,
                                         IRubyObject symbol)

protected_method_defined

public IRubyObject protected_method_defined(ThreadContext context,
                                            IRubyObject symbol)

private_method_defined

public IRubyObject private_method_defined(ThreadContext context,
                                          IRubyObject symbol)

public_class_method

public RubyModule public_class_method(IRubyObject[] args)

private_class_method

public RubyModule private_class_method(IRubyObject[] args)

alias_method

public RubyModule alias_method(ThreadContext context,
                               IRubyObject newId,
                               IRubyObject oldId)

undef_method

public RubyModule undef_method(ThreadContext context,
                               IRubyObject[] args)

module_eval

public IRubyObject module_eval(ThreadContext context,
                               Block block)

module_eval

public IRubyObject module_eval(ThreadContext context,
                               IRubyObject arg0,
                               Block block)

module_eval

public IRubyObject module_eval(ThreadContext context,
                               IRubyObject arg0,
                               IRubyObject arg1,
                               Block block)

module_eval

public IRubyObject module_eval(ThreadContext context,
                               IRubyObject arg0,
                               IRubyObject arg1,
                               IRubyObject arg2,
                               Block block)

module_eval

@Deprecated
public IRubyObject module_eval(ThreadContext context,
                                          IRubyObject[] args,
                                          Block block)
Deprecated. 


module_exec

public IRubyObject module_exec(ThreadContext context,
                               Block block)

module_exec

public IRubyObject module_exec(ThreadContext context,
                               IRubyObject[] args,
                               Block block)

remove_method

public RubyModule remove_method(ThreadContext context,
                                IRubyObject[] args)

marshalTo

public static void marshalTo(RubyModule module,
                             MarshalStream output)
                      throws java.io.IOException
Throws:
java.io.IOException

unmarshalFrom

public static RubyModule unmarshalFrom(UnmarshalStream input)
                                throws java.io.IOException
Throws:
java.io.IOException

nesting

public static RubyArray nesting(ThreadContext context,
                                IRubyObject recv,
                                Block block)
Return an array of nested modules or classes.


class_variable_defined_p

public IRubyObject class_variable_defined_p(ThreadContext context,
                                            IRubyObject var)

class_variable_get

public IRubyObject class_variable_get(IRubyObject var)
rb_mod_cvar_get


class_variable_set

public IRubyObject class_variable_set(IRubyObject var,
                                      IRubyObject value)
rb_mod_cvar_set


remove_class_variable

public IRubyObject remove_class_variable(ThreadContext context,
                                         IRubyObject name)
rb_mod_remove_cvar


class_variables

public RubyArray class_variables(ThreadContext context)
rb_mod_class_variables


class_variables19

public RubyArray class_variables19(ThreadContext context)

const_defined_p

public RubyBoolean const_defined_p(ThreadContext context,
                                   IRubyObject symbol)
rb_mod_const_defined


const_defined_p19

public RubyBoolean const_defined_p19(ThreadContext context,
                                     IRubyObject[] args)

const_get

public IRubyObject const_get(IRubyObject symbol)
rb_mod_const_get


const_get

public IRubyObject const_get(ThreadContext context,
                             IRubyObject[] args)

const_set

public IRubyObject const_set(IRubyObject symbol,
                             IRubyObject value)
rb_mod_const_set


remove_const

public IRubyObject remove_const(ThreadContext context,
                                IRubyObject rubyName)

const_missing

public IRubyObject const_missing(ThreadContext context,
                                 IRubyObject rubyName,
                                 Block block)
Base implementation of Module#const_missing, throws NameError for specific missing constant.

Parameters:
name - The constant name which was found to be missing
Returns:
Nothing! Absolutely nothing! (though subclasses might choose to return something)

constants

public RubyArray constants(ThreadContext context)

constants19

public RubyArray constants19(ThreadContext context)

constants19

public RubyArray constants19(ThreadContext context,
                             IRubyObject allConstants)

constantsCommon19

public RubyArray constantsCommon19(ThreadContext context,
                                   boolean replaceModule,
                                   boolean allConstants)

constantsCommon

public java.util.Collection<java.lang.String> constantsCommon(Ruby runtime,
                                                              boolean replaceModule,
                                                              boolean allConstants)
rb_mod_constants


setClassVar

public IRubyObject setClassVar(java.lang.String name,
                               IRubyObject value)
Set the named class variable to the given value, provided taint and freeze allow setting it. Ruby C equivalent = "rb_cvar_set"

Parameters:
name - The variable name to set
value - The value to set it to

fastSetClassVar

public IRubyObject fastSetClassVar(java.lang.String internedName,
                                   IRubyObject value)

getClassVar

public IRubyObject getClassVar(java.lang.String name)
Retrieve the specified class variable, searching through this module, included modules, and supermodules. Ruby C equivalent = "rb_cvar_get"

Parameters:
name - The name of the variable to retrieve
Returns:
The variable's value, or throws NameError if not found

fastGetClassVar

public IRubyObject fastGetClassVar(java.lang.String internedName)

isClassVarDefined

public boolean isClassVarDefined(java.lang.String name)
Is class var defined? Ruby C equivalent = "rb_cvar_defined"

Parameters:
name - The class var to determine "is defined?"
Returns:
true if true, false if false

fastIsClassVarDefined

public boolean fastIsClassVarDefined(java.lang.String internedName)

removeCvar

@Deprecated
public IRubyObject removeCvar(IRubyObject name)
Deprecated. - use removeClassVariable(String)

rb_mod_remove_cvar


removeClassVariable

public IRubyObject removeClassVariable(java.lang.String name)

getConstantAtSpecial

public IRubyObject getConstantAtSpecial(java.lang.String name)
This version searches superclasses if we're starting with Object. This corresponds to logic in rb_const_defined_0 that recurses for Object only.

Parameters:
name - the constant name to find
Returns:
the constant, or null if it was not found

getConstantAt

public IRubyObject getConstantAt(java.lang.String name)

fastGetConstantAt

public IRubyObject fastGetConstantAt(java.lang.String internedName)

getConstant

public IRubyObject getConstant(java.lang.String name)
Retrieve the named constant, invoking 'const_missing' should that be appropriate.

Parameters:
name - The constant to retrieve
Returns:
The value for the constant, or null if not found

getConstant

public IRubyObject getConstant(java.lang.String name,
                               boolean inherit)

fastGetConstant

public IRubyObject fastGetConstant(java.lang.String internedName)

fastGetConstant

public IRubyObject fastGetConstant(java.lang.String internedName,
                                   boolean inherit)

getConstantNoConstMissing

public IRubyObject getConstantNoConstMissing(java.lang.String name)

getConstantNoConstMissing

public IRubyObject getConstantNoConstMissing(java.lang.String name,
                                             boolean inherit)

getConstantInner

protected IRubyObject getConstantInner(java.lang.String name)

getConstantFrom

public IRubyObject getConstantFrom(java.lang.String name)

fastGetConstantFrom

public IRubyObject fastGetConstantFrom(java.lang.String internedName)

fastGetConstantFromNoConstMissing

public IRubyObject fastGetConstantFromNoConstMissing(java.lang.String internedName)

fastGetConstantFromConstMissing

public IRubyObject fastGetConstantFromConstMissing(java.lang.String internedName)

resolveUndefConstant

public IRubyObject resolveUndefConstant(Ruby runtime,
                                        java.lang.String name)

setConstantQuiet

public IRubyObject setConstantQuiet(java.lang.String name,
                                    IRubyObject value)
Set the named constant on this module. Also, if the value provided is another Module and that module has not yet been named, assign it the specified name. This version does not warn if the constant has already been set.

Parameters:
name - The name to assign
value - The value to assign to it; if an unnamed Module, also set its basename to name
Returns:
The result of setting the variable.

setConstant

public IRubyObject setConstant(java.lang.String name,
                               IRubyObject value)
Set the named constant on this module. Also, if the value provided is another Module and that module has not yet been named, assign it the specified name.

Parameters:
name - The name to assign
value - The value to assign to it; if an unnamed Module, also set its basename to name
Returns:
The result of setting the variable.

fastSetConstant

public IRubyObject fastSetConstant(java.lang.String internedName,
                                   IRubyObject value)

defineConstant

public void defineConstant(java.lang.String name,
                           IRubyObject value)
rb_define_const


isConstantDefined

public boolean isConstantDefined(java.lang.String name)
rb_const_defined_at


fastIsConstantDefined

public boolean fastIsConstantDefined(java.lang.String internedName)

fastIsConstantDefined19

public boolean fastIsConstantDefined19(java.lang.String internedName)

fastIsConstantDefined19

public boolean fastIsConstantDefined19(java.lang.String internedName,
                                       boolean inherit)

hasInternalModuleVariable

public boolean hasInternalModuleVariable(java.lang.String name)
Behaves similarly to getClassVar(String). Searches this class/module and its ancestors for the specified internal variable.

Parameters:
name - the internal variable name
Returns:
the value of the specified internal variable if found, else null
See Also:
setInternalModuleVariable(String, IRubyObject)

searchInternalModuleVariable

public IRubyObject searchInternalModuleVariable(java.lang.String name)
Behaves similarly to getClassVar(String). Searches this class/module and its ancestors for the specified internal variable.

Parameters:
name - the internal variable name
Returns:
the value of the specified internal variable if found, else null
See Also:
setInternalModuleVariable(String, IRubyObject)

setInternalModuleVariable

public void setInternalModuleVariable(java.lang.String name,
                                      IRubyObject value)
Behaves similarly to 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.

Parameters:
name - the internal variable name
value - the internal variable value
See Also:
searchInternalModuleVariable(String)

getClassVariables

protected java.util.Map<java.lang.String,IRubyObject> getClassVariables()

getClassVariablesForRead

protected java.util.Map<java.lang.String,IRubyObject> getClassVariablesForRead()

hasClassVariable

public boolean hasClassVariable(java.lang.String name)

fastHasClassVariable

public boolean fastHasClassVariable(java.lang.String internedName)

fetchClassVariable

public IRubyObject fetchClassVariable(java.lang.String name)

fastFetchClassVariable

public IRubyObject fastFetchClassVariable(java.lang.String internedName)

storeClassVariable

public IRubyObject storeClassVariable(java.lang.String name,
                                      IRubyObject value)

fastStoreClassVariable

public IRubyObject fastStoreClassVariable(java.lang.String internedName,
                                          IRubyObject value)

deleteClassVariable

public IRubyObject deleteClassVariable(java.lang.String name)

getClassVariableNameList

public java.util.List<java.lang.String> getClassVariableNameList()

validateClassVariable

protected final java.lang.String validateClassVariable(java.lang.String name)

ensureClassVariablesSettable

protected final void ensureClassVariablesSettable()

hasConstant

public boolean hasConstant(java.lang.String name)

fastHasConstant

public boolean fastHasConstant(java.lang.String internedName)

fetchConstant

public IRubyObject fetchConstant(java.lang.String name)

fastFetchConstant

public IRubyObject fastFetchConstant(java.lang.String internedName)

storeConstant

public IRubyObject storeConstant(java.lang.String name,
                                 IRubyObject value)

fastStoreConstant

public IRubyObject fastStoreConstant(java.lang.String internedName,
                                     IRubyObject value)

deleteConstant

public IRubyObject deleteConstant(java.lang.String name)

getStoredConstantList

@Deprecated
public java.util.List<Variable<IRubyObject>> getStoredConstantList()
Deprecated. 


getStoredConstantNameList

@Deprecated
public java.util.List<java.lang.String> getStoredConstantNameList()
Deprecated. 


getConstantNames

public java.util.Collection<java.lang.String> getConstantNames()
Returns:
a list of constant names that exists at time this was called

validateConstant

protected final java.lang.String validateConstant(java.lang.String name)

ensureConstantsSettable

protected final void ensureConstantsSettable()

constantTableContains

protected boolean constantTableContains(java.lang.String name)

constantTableFastContains

protected boolean constantTableFastContains(java.lang.String internedName)

constantTableFetch

protected IRubyObject constantTableFetch(java.lang.String name)

constantTableFastFetch

protected IRubyObject constantTableFastFetch(java.lang.String internedName)

constantTableStore

protected IRubyObject constantTableStore(java.lang.String name,
                                         IRubyObject value)

constantTableFastStore

protected IRubyObject constantTableFastStore(java.lang.String internedName,
                                             IRubyObject value)

constantTableRemove

protected IRubyObject constantTableRemove(java.lang.String name)


Copyright © 2002-2009 JRuby Team. All Rights Reserved.