From: Florian Frank Date: 2004-06-17T17:25:11+09:00 Subject: Re: [OT] RE: require vs require_gem On 17.06.2004, at 05:53, Richard Kilmer wrote: > I second that, and actually put some 'require' statements in methods > right > before I use them. That way if a method is called, the library is > loaded, > otherwise not: > > def load_from_yaml(filename) > require 'yaml' > YAML.load(File.read(filename)) > end > > So if this method is called, yaml is loaded (if necessary), otherwise > its > not. Another possibility would be to autoload :YAML, 'yaml' at the beginning of your file. The advantage is that you can mass all your dependencies at one place and only have to do that once even if more than one method requires the file. Florian Frank