Module

The module class.

Superclass

Method

self === obj

This method is mostly used for comparison within case statements. Returns true if obj has an Object#kind_of? relationship with self. In other words, case can be used to check the owner relationship of classes and modules.

str = String.new
case str
when String     # evaluates String === str
  p true        # => true
end

Private Methods

attr_accessor(name ... )

Defines both the read and write methods for the attribute name, where name is specified by Symbol or a string.

The definition of the method defined by attr_accessor is as follows:

def name
  @name
end
def name=(val)
  @name = val
end
attr_reader(name ... )

Defines the read method for the attribute name, where name is specified by Symbol or a string.

The definition of the method defined by attr_reader is as follows:

def name
  @name
end
attr_writer(name ... )

Defines the writer method for the specified attribute(s).

Defines the write method for the attribute name (name=), where name is specified by Symbol or a string.

The definition of the method defined by attr_writer is as follows:

def name=(val)
  @name = val
end
include(module ... )

Includes the specified modules' properties (methods and constants). Returns self. include is used to implement a mix-in in place of a multiple inheritance.

class C
  include FileTest
  include Math
end

Module capabilities are included by inserting modules into a class inheritance. Therefore, when searching for methods, included modules will be given priority over superclasses.

If the same module is included two or more times, the second and later instances will be ignored. Furthermore, executing an include that results in a recursive module inheritance will throw an ArgumentError exception.

Converted from CHM to HTML with chm2web Pro 2.85 (unicode)