Ruby - Module Module

Introduction

Modules and classes are closely related.

The Module class is the immediate ancestor of the Class class.

A module can contain constants, methods, and classes.

Here's a simple module:

module MyModule
    REWARD = 100

    def prize
        return "You've won #{REWARD} credits"
    end

end

Related Topic