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.
Object.const_set("FOO", 40)
But I check ruby doc, there is no const_set in Object method, then I found out it was defined in Module.
I thought Object is the default root of all Ruby objects. Why it can use module method? I am confused about the relationship between those.
'Hello'.upcase, where would you look for theupcasemethod … in the string'Hello'or in its class (String) and its superclasses? Now, if you callObject.const_set, where would you look for theconst_setmethod … in the classObjector in its class (Class) and its superclasses?