From: 7stud -- Date: 2007-11-06T08:48:55+09:00 Subject: Re: Reading a class-file and calling it at runtime. Sean O'halpin wrote: > On 11/5/07, 7stud -- 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? > > It's a way of looking up constants in the scope of the top level > binding (the special Object known as 'main'). > ... so are Module.const_get and Class.const_get: class Dog end module Stuff Greeting = "hello" end MyConst = 10 puts Module.const_get("Dog").new puts Module.const_get("Stuff")::Greeting puts Module.const_get("MyConst") puts puts Class.const_get("Dog").new puts Class.const_get("Stuff")::Greeting puts Class.const_get("MyConst") --output:-- # hello 10 # hello 10 -- Posted via http://www.ruby-forum.com/.