I'm confused about these two class when I was reading Module document.
First of all, I saw there is a way to set the named constant to the given object.
As shown below
:const_set is an instance method stored in
Module.instance_methods(false).include? :const_set #=> true
Also note that
Object is an instance of
Object.instance_of? Class #=> true
Class is a subclass of
Class.ancestors #=> [Class, Module, Object, Kernel, BasicObject]
All of this means that instance methods defined within
Module are available to
Class objects via inheritance. So any instance of
Class (such as
Object) has at its disposal all the instance methods (including
:const_set) stored in