If you delete the last line, you will see that you get 5, 4, 3, 2 . The reason is that the body of classes and modules is regular code (unlike some other languages). Therefore, these print instructions will be executed when classes / modules are processed.
How it works :: - it just allows you to navigate areas. ::A will refer to A in the main area. Just A will refer to A in the current area. A::B will refer to B , which is inside A , which is inside the current region.
source share