diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-02-07 10:56:16 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-02-07 10:56:16 +0000 |
commit | 776206b3e7a1374e8517431c9f63745079b3b1bf (patch) | |
tree | ca6bc1031b6c0e103f7d78121380511fa0225bd7 /lib/irb/init.rb | |
parent | 7f55b0c39ec801aa852824bf8b10c2f741a148bf (diff) | |
download | ruby-776206b3e7a1374e8517431c9f63745079b3b1bf.tar.gz |
* lib/irb/init.rb (IRB.rc_files): yield possible rc file names.
* lib/irb/input-method.rb (IRB::ReadlineInputMethod::initialize):
load and save history automatically. [ruby-core:02352]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5638 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/irb/init.rb')
-rw-r--r-- | lib/irb/init.rb | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/lib/irb/init.rb b/lib/irb/init.rb index 9fd86e94a2..1df2926fa5 100644 --- a/lib/irb/init.rb +++ b/lib/irb/init.rb @@ -180,17 +180,20 @@ module IRB end end + # enumerate possible rc files + def IRB.rc_files(rc) + yield File.expand_path("~/.irb#{rc}") if ENV.key?("HOME") + yield ".irb#{rc}" + yield "irb#{rc.sub(/\A_?/, '.')}" + yield "_irb#{rc}" + yield "$irb#{rc}" + end + # running config def IRB.run_config if @CONF[:RC] - rcs = [] - rcs.push File.expand_path("~/.irbrc") if ENV.key?("HOME") - rcs.push ".irbrc" - rcs.push "irb.rc" - rcs.push "_irbrc" - rcs.push "$irbrc" catch(:EXIT) do - for rc in rcs + rc_files("rc") do |rc| begin load rc throw :EXIT |