From: Robert Klemme Date: 2010-02-03T17:20:54+09:00 Subject: Re: Refining the use of file joins or file expand_path 2010/2/2 Alpha Blue : > Robert Klemme wrote: >> >> "require" is for loading library code (libs as parts of the >> installation, self written libs as well as gems). >> >> "load" is for explicitly forcing a file load and execution at a define >> place in the source code. > > Thanks for the clarification Robert and I like your distinction because > it makes more sense to me.  With your example in place, I am using > require and load statements correctly then. The only thing I've been > doing with regard to load statements is defining an absolute load path > rather than a relative load path.  Code execution in this example is the > loading of an xml source file (xrc) by wx_sugar. Ah, OK. Then of course load is more appropriate. > This is strange because I don't know why I never thought about doing > this with Ruby.  I'm so used to keeping my projects separate and > therefore, I tend to keep the libs separate.  However, I could see > defining a libs dir for reusable library classes that I require in > future projects.  Then, all I would have to do is require and/or include > the code I need.  Ocra does look over the rubyopt variables set at the > time of processing.  I'll have to check the $: to see that my custom lib > directories are being set properly and included, but I can definitely > see this being a better way of implementing things later on.  I can > privatize and store all my libs on github for safekeeping and rdoc > everything for my own benefit. Well, you can even have a mix of both: you can set RUBYLIB to your "shared libs" folder and then in every main executable add an appropriate folder of your local project. And we're back to the original question IIRC. :-) If you have to do that on multiple machines though then it might be reasonable to use gems for distribution and use the gems mechanism as storage for the shared libs. But the principle would be the same. >> Hope that helps. > It does - my thanks! You're welcome! Cheers robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/