Ah, I understand. Simply a class method (like in Objective-C). I just
wasn't careful about the fact in inherited from Module (the class
object hierarchy). This can be difficult to understand for Java
developer who don't have real class objects and where static
functions are not inherited.
Thanks,
--
Alexander Lamb
Service d'Informatique MņÅicale
Hitaux Universitaires de Genī×e
Alexander.J.Lamb / sim.hcuge.ch
+41 22 372 88 62
+41 79 420 79 73
On Oct 13, 2005, at 10:10 PM, Christophe Grandsire wrote:
> En rņŅonse Alexander Lamb :
>
>> However, I didn't find it in the documentation of the Object
>> class. I started on ruby-lang.org then was brought to
>> rubycentral for the reference.
>> Is there another complete reference for ruby 1.8.x? (I am running
>> on MacOSX 10.4.2).
>>
>
> http://www.ruby-doc.org/
> However, the best way is to use ri, the built-in documentation
> system for Ruby. Just type ri ClassOrModuleName#method to get the
> documentation for that instance method (without the #method, you
> get the documentation for the class or module itself, with lists of
> constants, class or module methods and instance methods, and for
> class or module methods the syntax is IIRC ri
> ClassOrModuleName::class_or_module_method).
>
> But anyway, const_get isn't defined in Object but in Module. When
> you call Object.const_get, you are calling an instance method of
> the object "Object", which is an object of class "Class". Since
> Class inherits from Module, it inherits its instance method
> "const_get", which can thus be called on any object of class
> "Class", i.e. any class.
>
> If you don't really understand it, do not fear. It took me a while
> to get it too. Just remember that in Ruby everything is an object,
> and that includes classes themselves :) . So you can send methods
> to them too.
> --
> Christophe Grandsire.
>
> http://rainbow.conlang.free.fr
>
> You need a straight mind to invent a twisted conlang.
>
>