Forum: Ruby Cannot customize irb initialization

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
5feab09c8481f57ab1c6089a31b39359?d=identicon&s=25 Fredrik (Guest)
on 2009-02-19 06:15
(Received via mailing list)
Why can't I give a configuration file as argument when I run irb? It
seems that looks for conf files in the order:
~/.irbrc
.irbrc
irb.rc
_irbrc
$irbrc

I would however like to have more flexibility than that. I would like
to be able to use a special conf file in whichever directory I am. Is
it only me who wants this flexibility? To me the ability to give a
conf file as argument seems like the most obvious argument to have in
irb.

Best regards,
Fredrik
47b1910084592eb77a032bc7d8d1a84e?d=identicon&s=25 Joel VanderWerf (Guest)
on 2009-02-19 07:33
(Received via mailing list)
Fredrik wrote:
> it only me who wants this flexibility? To me the ability to give a
> conf file as argument seems like the most obvious argument to have in
> irb.

How about

irb -r config.rb

?
5feab09c8481f57ab1c6089a31b39359?d=identicon&s=25 Fredrik (Guest)
on 2009-02-19 08:45
(Received via mailing list)
> How about
>
> irb -r config.rb
>
I tried that but it didn't work. I don't think irb treats the file
given by -r as a configuration. I runs what is written in the file as
if written by the user once irb has started.
47b1910084592eb77a032bc7d8d1a84e?d=identicon&s=25 Joel VanderWerf (Guest)
on 2009-02-19 08:53
(Received via mailing list)
Fredrik wrote:
>> How about
>>
>> irb -r config.rb
>>
> I tried that but it didn't work. I don't think irb treats the file
> given by -r as a configuration. I runs what is written in the file as
> if written by the user once irb has started.

What do you mean by "treats as configuration"? How is the effect of -r
different?
5feab09c8481f57ab1c6089a31b39359?d=identicon&s=25 Fredrik (Guest)
on 2009-02-20 02:50
(Received via mailing list)
> > I tried that but it didn't work. I don't think irb treats

Sorry, I'm crazy. I didn't realize that my config file should be named
config.rb instead of config.rc... What a silly mistake... Not it's all
working great!
F1d6cc2b735bfd82c8773172da2aeab9?d=identicon&s=25 Nobuyoshi Nakada (nobu)
on 2009-02-20 05:13
(Received via mailing list)
Hi,

At Thu, 19 Feb 2009 15:33:24 +0900,
Joel VanderWerf wrote in [ruby-talk:328701]:
> How about
>
> irb -r config.rb
>
> ?

Yet another way.

IRBRC=config.rb irb
This topic is locked and can not be replied to.