Forum: Ruby autoload with rubygems?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Fbb4d027695dfdf76bf448b15d7e306a?d=identicon&s=25 matt neuburg (Guest)
on 2008-10-14 19:46
(Received via mailing list)
I'm sure this has been asked before but I couldn't find an actual
answer.

This works:

require 'rubygems'
require 'ruby-prof'
RubyProf.start

This doesn't:

require 'rubygems'
autoload(:RubyProf, 'ruby-prof')
RubyProf.start #=> LoadError: no such file to load - ruby-prof

What am I doing wrong? I'd like to "weak-link" certain gems so that my
users don't have to install a gem unless they encounter the part of my
code that actually uses it. Thx - m.
This topic is locked and can not be replied to.