2010/1/26 Xavier Noria <fxn / hashref.com>: > Ruby takes its arguments from a global array called ARGV. That array > is special because it is initialized by the interpreter, buy from then > on it is a regular mutable array. > > In particular you can modify it: > > ¨Âåæ ÷éôèßáòçö¨ªáòçö© > ¨Âòéçéîáìßáòçö ÁÒÇÖ®äõð > ¨ÂÒÇÖ®òåðìáãå¨áòçö> ¨Âéåìä > ¨ÂÒÇÖ®òåðìáãå¨ïòéçéîáìßáòçö© > ¨Âîä This is not exception safe. You'd rather want the restoration in an ensure block. I would also return the result of yield rather than the result of doing ARGV.replace. > You would use that method this way: > > ¨Âéôèßáòçö¨±²¬ ³© äï > ¨Âåñõéòå §¯ïðô¯òõâù¯óãòéðô±> ¨Âîä > > Not that it is a good practice, you normall would invoke the scripts > using #system or whatever, but since you say you are not a programmer > that would fit into your current model if you don't feel confident to > explore system. "Require" is not a good tool in this case as it will load a script only once and is primarily intended to be used for loading library code. If at all I would rather use "load". So this would be an alternative def with_args(*args) backup = ARGV.dup begin ARGV.replace(args) yield ensure ARGV.replace(backup) end end Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/