In my Ruby program, I am trying to lazy load the library ( crack for the curious).
If I do this:
require 'rubygems'
require 'crack'
Everything is working fine. However, when I try this:
require 'rubygems'
autoload :Crack, 'crack'
Raised LoadError. (there is no such file to download - crack)
Why is this error occurring? Is it because the “crack” (and therefore my other user-set gems) is not in my $ LOAD_PATH?
edit:
In addition, it autoloadworks with the standard library:
autoload :Yaml, 'yaml'
It works fine and does not cause errors.
source
share