2009/12/23 Iki Baz Castillo <ibc / aliax.net>:
> 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.

Kind regards

robert

-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/