Defining Nested Modules in Ruby

Nested Modules in Ruby

Ruby provides two different ways to define nested modules. This post explains the difference between them and how to decide which one to use. It also explains the `Module.nesting` method which returns the list of modules nested when called.

1 min read

Update: A newer version of the article is published at ->

Nested Modules in Ruby
There are two different ways to define nested modules in Ruby. This post explains them both along with the differences between them and how to decide which one to use. We will also learn about the `Module.nesting` method, which returns the list of nesting for a module.