From: Austin Ziegler Date: 2005-08-13T00:27:42+09:00 Subject: Re: LibInject 0.1.0: Small Pieces Smooshed Together On 8/12/05, Francis Hwang wrote: > Jim Weirich wrote: > > Cool! Does it handle things like this: > > > > class Command > > def create_option_parser > > require 'optparse' > > @parser = OptionParser.new > > ... > > end > > end > > Nope. It really only handles the simplest, most common case, of the > require statement being on its own line outside of any class/method > definitions. I could try to make it smart enough to pull require > statements out of class & method definitions, but I'm not certain if > it'd be worth the effort. Are there actually many libs out there that > use requires this way? I personally try to avoid just 'cause I think it > makes the code look messier, but obviously that's sort of just a > personal style thing. I generally have all of my includes outside of methods, but there are definite times when it is advantageous to do that in a method (e.g., when your code requires something 'big' and you want to delay loading as long as possible). PDF::Writer *sort-of* does that with REXML, only requiring it if on a Unix/Linux platform. -austin -- Austin Ziegler * halostatue@gmail.com * Alternate: austin@halostatue.ca