included_modules

mod.included_modules â array Instance Public methods Returns the list of modules included in mod. module Mixin end module Outer include Mixin end Mixin.included_modules #=> [] Outer.included_modules #=> [Mixin]

include?

mod.include?(module) â true or false Instance Public methods Returns true if module is included in mod or one of mod's ancestors. module A end class B include A end class C < B end B.include?(A) #=> true C.include?(A) #=> true A.include?(A) #=> false

freeze

mod.freeze â mod Instance Public methods Prevents further modifications to mod. This method returns self.

constants 2

mod.constants(inherit=true) â array Instance Public methods Returns an array of the names of the constants accessible in mod. This includes the names of constants in any included modules (example at start of section), unless the inherit parameter is set to false. IO.constants.include?(:SYNC) #=> true IO.constants(false).include?(:SYNC) #=> false Also see Module::const_defined?.

const_set

mod.const_set(sym, obj) â obj Instance Public methods Sets the named constant to the given object, returning that object. Creates a new constant if no constant with the given name previously existed. Math.const_set("HIGH_SCHOOL_PI", 22.0/7.0) #=> 3.14285714285714 Math::HIGH_SCHOOL_PI - Math::PI #=> 0.00126448926734968

const_missing

const_missing(const_name) Instance Public methods Check for deprecated uses of top level (i.e. in Object) uses of Rake class names. If someone tries to reference the constant name, display a warning and return the proper object. Using the âclassic-namespace command line option will define these constants in Object and avoid this handler. rake_original_const_missing

const_get

mod.const_get(sym, inherit=true) â objmod.const_get(str, inherit=true) â obj Instance Public methods Checks for a constant with the given name in mod If inherit is set, the lookup will also search the ancestors (and Object if mod is a Module.) The value of the constant is returned if a definition is found, otherwise a NameError is raised. Math.const_get(:PI) #=> 3.14159265358979 This method will recursively look up constant names if a namespaced class name is provided.

const_defined?

mod.const_defined?(sym, inherit=true) â true or false Instance Public methods Says whether mod or its ancestors have a constant with the given name: Float.const_defined?(:EPSILON) #=> true, found in Float itself Float.const_defined?("String") #=> true, found in Object (ancestor) BasicObject.const_defined?(:Hash) #=> false If mod is a Module, additionally Object and its ancestors are checked: Math.const_defined?(:String) #=> true, found in Object In ea

class_variables

mod.class_variables(inherit=true) â array Instance Public methods Returns an array of the names of class variables in mod. This includes the names of class variables in any included modules, unless the inherit parameter is set to false. class One @@var1 = 1 end class Two < One @@var2 = 2 end One.class_variables #=> [:@@var1] Two.class_variables #=> [:@@var2, :@@var1] Two.class_variables(false) #=> [:@@var2]

class_variable_set

obj.class_variable_set(symbol, obj) â obj Instance Public methods Sets the class variable names by symbol to object. class Fred @@foo = 99 def foo @@foo end end Fred.class_variable_set(:@@foo, 101) #=> 101 Fred.new.foo #=> 101