ts wrote:
>>>>>>"D" == Damphyr  <damphyr / freemail.gr> writes:
> 
> 
> D> Object.const_get("MyModule")
> 
> D> and he's right. The reference in the PP book puts const_get in Module 
> D> though - is there something hidden in there, or is it just an error in 
> D> the reference?
> 
>  #const_get is a method of Module, this mean that the class Object inherit
>  this method
But I thought it was the other way around: Module inherits from Object 
and not Object from Module. Object is the root of our hierarchy.

var@dfnnb023 ~
$ ruby -e 'puts Module.superclass'
Object

var@dfnnb023 ~
$ ruby -e 'puts Object.superclass'
nil

>  Now the module is defined in Object, this mean that you must retrieve this
>  constant in Object. For example, if you want to retrieve the class
>  File::Stat you must search the constant "Stat" in the class File

This was clear as soon as I realized that Classes and Modules are 
constants and applied some namespacing logic.
Doing

puts Object.methods

gives a whole lot more than that listed in the reference, including the 
const_get method.
And then I thought that Object is a Class and Class is derived from 
Module and somewhere there I got confused because Module is derived from 
Object and Object...this is an endless cycle (I'm only semi-joking :) )
V.-



--
http://www.freemail.gr - δωρεάν υπηρεσία ηλεκτρονικού ταχυδρομείου.