May someone call the right phrase: “Ruby period!”
I spent at least two weeks to understand this :: operator. But why ?
If you, have no C++ or C# strong background like me, certainly the :: operator will cost you more time to learn.
First of all :: appears all around Ruby programs, and this could be a little tricky…
You have to consider just one thing:
The :: is a unary operator that allows: constants, instance methods and class methods defined within a class or module, to be accessed from anywhere outside the class or module.
Remember: in Ruby, classes and methods may be considered constants too.
You need just to prefix the ::Const_name with an expression that returns the appropriate class or module object.
If no prefix expression is used, the main Object class is used by default.
So, the operator syntax is:
You can see samples here.
Hope it helps You not to waste time on this subject.