ruby-changes:8142
From: keiju <ko1@a...>
Date: Sat, 4 Oct 2008 12:26:32 +0900 (JST)
Subject: [ruby-changes:8142] Ruby:r19670 (trunk): * lib/irb/irb/ext/save-history.rb: change load_history using File.expand_path. see . Thanks Kouhei Sutou.
keiju 2008-10-04 12:26:16 +0900 (Sat, 04 Oct 2008) New Revision: 19670 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=19670 Log: * lib/irb/irb/ext/save-history.rb: change load_history using File.expand_path. see [ruby-dev:36660]. Thanks Kouhei Sutou. * lib/irb/irb/context.rb: convert string Symbol of instance variable names in IRB:Context#inspect. Modified files: trunk/ChangeLog trunk/lib/irb/context.rb trunk/lib/irb/ext/save-history.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 19669) +++ ChangeLog (revision 19670) @@ -1,3 +1,8 @@ +Sat Oct 4 12:17:46 2008 Keiju Ishitsuka <keiju@r...> + + * lib/irb/irb/ext/save-history.rb: change load_history using File.expand_path. see [ruby-dev:36660]. Thanks Kouhei Sutou. + * lib/irb/irb/context.rb: convert string Symbol of instance variable names in IRB:Context#inspect. + Fri Oct 3 22:43:04 2008 Yuki Sonoda (Yugui) <yugui@y...> * ext/dl/extconf.rb ($distcleanfiles): added callback-?.c into Index: lib/irb/context.rb =================================================================== --- lib/irb/context.rb (revision 19669) +++ lib/irb/context.rb (revision 19670) @@ -233,6 +233,7 @@ def inspect array = [] for ivar in instance_variables.sort{|e1, e2| e1 <=> e2} + ivar = ivar.to_s name = ivar.sub(/^@(.*)$/, '\1') val = instance_eval(ivar) case ivar Index: lib/irb/ext/save-history.rb =================================================================== --- lib/irb/ext/save-history.rb (revision 19669) +++ lib/irb/ext/save-history.rb (revision 19670) @@ -52,11 +52,11 @@ def HistorySavingAbility.create_finalizer proc do if num = IRB.conf[:SAVE_HISTORY] and (num = num.to_i) > 0 - if hf = IRB.conf[:HISTORY_FILE] - file = File.expand_path(hf) + if history_file = IRB.conf[:HISTORY_FILE] + history_file = File.expand_path(history_file) end - file = IRB.rc_file("_history") unless file - open(file, 'w' ) do |f| + history_file = IRB.rc_file("_history") unless history_file + open(history_file, 'w' ) do |f| hist = HISTORY.to_a f.puts(hist[-num..-1] || hist) end @@ -71,10 +71,12 @@ end def load_history - hist = IRB.conf[:HISTORY_FILE] - hist = IRB.rc_file("_history") unless hist - if File.exist?(hist) - open(hist) do |f| + if history_file = IRB.conf[:HISTORY_FILE] + history_file = File.expand_path(history_file) + end + history_file = IRB.rc_file("_history") unless history_file + if File.exist?(history_file) + open(history_file) do |f| f.each {|l| HISTORY << l.chomp} end end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/