Skip to content

Instantly share code, notes, and snippets.

@Quemia
Last active April 2, 2020 03:08
Show Gist options
  • Select an option

  • Save Quemia/beb94f4066720320402e4714dcb8b081 to your computer and use it in GitHub Desktop.

Select an option

Save Quemia/beb94f4066720320402e4714dcb8b081 to your computer and use it in GitHub Desktop.

Module

It is a collection of constant, variable and stored constant methods and a container.

It is similar to a class, but cannot be instantiated.

It is defined by the keyword module

Ex:

module Greeting
  def hello
    puts "Hello Sir/ Ma'am"
  end
end

Module - starts the definition of a new module.

Greeting - is how the module is named.

Within this module, we define a hello method

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment