diff options
author | keiju <keiju@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-10-04 03:26:16 +0000 |
---|---|---|
committer | keiju <keiju@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-10-04 03:26:16 +0000 |
commit | 0fdc3b4bc509f7d5e532c2f5997be4c75b3bc933 (patch) | |
tree | 71700753dc8b7daae6d37df2bd603c0ba208f6d7 | |
parent | ade6d076a9194995ddfd4f988f0bcebb0d1bc88a (diff) |
* 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.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19670 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | lib/irb/context.rb | 1 | ||||
-rw-r--r-- | lib/irb/ext/save-history.rb | 18 |
3 files changed, 16 insertions, 8 deletions
@@ -1,3 +1,8 @@ +Sat Oct 4 12:17:46 2008 Keiju Ishitsuka <[email protected]> + + * 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) <[email protected]> * ext/dl/extconf.rb ($distcleanfiles): added callback-?.c into diff --git a/lib/irb/context.rb b/lib/irb/context.rb index 6a5e77fb70..e2ab05a341 100644 --- a/lib/irb/context.rb +++ b/lib/irb/context.rb @@ -233,6 +233,7 @@ module IRB 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 diff --git a/lib/irb/ext/save-history.rb b/lib/irb/ext/save-history.rb index fdb0a74a86..30eafdfe63 100644 --- a/lib/irb/ext/save-history.rb +++ b/lib/irb/ext/save-history.rb @@ -52,11 +52,11 @@ module IRB 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 @@ module IRB 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 |