This is a theoretical question. I know that I can call a method by using ::
. It is rarely used, but possible. For example:
user = User.new
user::name
The question is: How it is working under the hood? What are the implementation details allowing us to do user::name
?
I found some places where this way of calling method is mentioned like:
but they do not provide the implementation details, which for me is interesting topic. I also tried to go through the Ruby source code, but for now without any success.
I also checked those threads:
- . vs :: (dot vs. double-colon) for calling a method
- What is Ruby's double-colon
::
? - What does :: (double colon) mean in Ruby?
- Ruby's double colon (::) operator usage differences
- Double colons before class names in Ruby?
- Double colons in Ruby's class definition
- What does constant prefixed with double colons mean?
- Idiomatic use of double-colon (double-column, or ::) syntax for Ruby methods
- difference between dot(.) and double colon (::) in accessing class method
They are explaining how ::
works and differences between ::
and .
. And this is not what I search for.
I would appreciate any information that can help me to learn more about ::
to understand it deeply. My question is about how the ::
works inside, not how to use it. I would like to get to know implementation details for ::
.