From: 7stud -- Date: 2007-11-06T03:43:39+09:00 Subject: Re: Reading a class-file and calling it at runtime. 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? I find calling const_get with Object very confusing because the Object class does not define a const_get method--it's only tracking const_get through ruby's extremely confusing circular inheritance: Object <------+ | | V | Module | --const_get | | | | V | Class ---------+ that const_get lands in Object. Since calling const_get with any of the class names Object, Module, or Class seems to work, why not just use Module or Class to call const_get? If no Modules are involved, which seems to be the op's case, then Class would seem like the least confusing name to call const_get with. #plugin.rb: class Dog def speak puts "Woof woof" end end ----------- #my_program.rb: require 'plugin' 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. -- Posted via http://www.ruby-forum.com/.