From: "Iñaki Baz Castillo" Date: 2009-12-23T22:30:58+09:00 Subject: Re: How to pass commandline arguments to a file loaded with "irb -r file" ? El Miércoles, 23 de Diciembre de 2009, Robert Klemme escribió: > 2009/12/23 Iñaki Baz Castillo : > > Hi, I run "irb -r myfile.rb" and would like "myfile.rb" to receive > > commandline arguments, and these not to conflict with irb parameters. > > > > Is it possible? I couldn't get it. What I'd like is something as: > > > > ~# irb -r myfile.rb -p 9898 -s lala > > > > so ARGVinspected in "myfile.rb" would contain: > > ["-p", "9898", "-s", "lala"] > > > > Is it possible? Thanks a lot. > > #require is not build to pass arguments around - neither is #load. > One of the reasons is that you do not know whether the file is > actually loaded at that moment. > > The easier solution is probably to do it the other way round: build a > script which processes arguments and then fires off IRB. You can look > at your "irb" script to get a starting point how to do that. The you > would do > > myfile.rb -p 9898 -s lala > > and receive an IRB prompt. It makes lot of sense. Thanks a lot. -- Iñaki Baz Castillo