From: Phrogz Date: 2007-11-06T04:45:05+09:00 Subject: Re: Reading a class-file and calling it at runtime. On Nov 5, 11:43 am, bbxx789_0...@yahoo.com wrote: > Sean O'halpin wrote: > > > plugin_class = Object.const_get(plugin_class_name).new > > I have a question about using Object as the receiver in the above line. > Is there any specific reason you are using Object? > dog_class = Class.const_get("Dog") > dog = dog_class.new > dog.speak > > Of course calling const_get with Class might still result in some > confusion--looking up the methods for Class will not reveal a const_get > method. For me personally, having someone write Module.const_get versus Class.const_get implies that the former will only return a Module instance, and the latter would only return a Class instance. By using Object.const_get you are clearly stating that there is no guarantee as to what type of object the supplied constant points to.