class DRbProxy::Server @@klasses = [] def initialize(options={}) @debug = options[:debug] end def ready? true end def new_object_for(klass_name, *args) puts "Initializing new object #{klass_name}" if @debug klass = get_klass(klass_name) return klass.new(*args) end def klass_for(klass_name) return get_klass(klass_name) end def constant_for(klass_name, const_name) puts "Retrieving constant #{klass_name}::#{const_name}" if @debug return get_klass(klass_name).const_get(const_name) end def get_klass(klass_name) klass_arch = klass_name.split('::') klass = Kernel klass_arch.each { |k| klass = klass.const_get(k) } unless @@klasses.include?(klass) klass.send :include, DRb::DRbUndumped klass.send :extend, DRb::DRbUndumped @@klasses << klass puts "Defined new class #{klass_name}" if @debug end klass end end