Sha256: dd77d3ae5afc3d02ff91c6d9a950e60d5aa4fe5828d8c3d38601ab52b293b8ce

Contents?: true

Size: 664 Bytes

Versions: 2

Compression:

Stored size: 664 Bytes

Contents

A Module is a collection of methods and constants.
Modules are often used as a way to "mixin" methods
and constants into different classes that may not
have similar inheritance. They are also used for
what is known as "namespacing," where you group
similar methods or classes. The methods in a module
may be instance methods or module methods. Instance
methods appear as methods in a class when the module
is included, module methods do not. In order to mix
a module with a class, the 'Include' method is used.

Example:
module Speak
  def world
    puts "Hello World"
  end
end

class Hello
  include Speak
end

hello = Hello.new
hello.world    #=> "Hello World"

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rubytutor-0.1.1 lib/descriptions/Module.txt
rubytutor-0.1.0 lib/descriptions/Module.txt