summaryrefslogtreecommitdiff
path: root/lib/irb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/irb')
-rw-r--r--lib/irb/cmd/chws.rb2
-rw-r--r--lib/irb/cmd/fork.rb2
-rw-r--r--lib/irb/cmd/help.rb2
-rw-r--r--lib/irb/cmd/load.rb2
-rw-r--r--lib/irb/cmd/nop.rb2
-rw-r--r--lib/irb/cmd/pushws.rb2
-rw-r--r--lib/irb/cmd/subirb.rb2
-rw-r--r--lib/irb/context.rb47
-rw-r--r--lib/irb/ext/change-ws.rb2
-rw-r--r--lib/irb/ext/history.rb2
-rw-r--r--lib/irb/ext/loader.rb2
-rw-r--r--lib/irb/ext/math-mode.rb2
-rw-r--r--lib/irb/ext/multi-irb.rb2
-rw-r--r--lib/irb/ext/save-history.rb2
-rw-r--r--lib/irb/ext/tracer.rb2
-rw-r--r--lib/irb/ext/use-loader.rb2
-rw-r--r--lib/irb/ext/workspaces.rb2
-rw-r--r--lib/irb/extend-command.rb2
-rw-r--r--lib/irb/help.rb2
-rw-r--r--lib/irb/init.rb10
-rw-r--r--lib/irb/input-method.rb2
-rw-r--r--lib/irb/lc/error.rb2
-rw-r--r--lib/irb/lc/help-message2
-rw-r--r--lib/irb/lc/ja/error.rb2
-rw-r--r--lib/irb/lc/ja/help-message2
-rw-r--r--lib/irb/locale.rb4
-rw-r--r--lib/irb/notifier.rb2
-rw-r--r--lib/irb/output-method.rb2
-rw-r--r--lib/irb/ruby-lex.rb2
-rw-r--r--lib/irb/ruby-token.rb2
-rw-r--r--lib/irb/slex.rb2
-rw-r--r--lib/irb/version.rb6
-rw-r--r--lib/irb/workspace.rb2
-rw-r--r--lib/irb/ws-for-case-2.rb2
34 files changed, 85 insertions, 42 deletions
diff --git a/lib/irb/cmd/chws.rb b/lib/irb/cmd/chws.rb
index e225b52..65c9770 100644
--- a/lib/irb/cmd/chws.rb
+++ b/lib/irb/cmd/chws.rb
@@ -1,6 +1,6 @@
#
# change-ws.rb -
-# $Release Version: 0.9.5$
+# $Release Version: 0.9.6$
# $Revision$
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
diff --git a/lib/irb/cmd/fork.rb b/lib/irb/cmd/fork.rb
index 534f13f..45350cb 100644
--- a/lib/irb/cmd/fork.rb
+++ b/lib/irb/cmd/fork.rb
@@ -1,6 +1,6 @@
#
# fork.rb -
-# $Release Version: 0.9.5 $
+# $Release Version: 0.9.6 $
# $Revision$
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
diff --git a/lib/irb/cmd/help.rb b/lib/irb/cmd/help.rb
index 146acdf..de3c6bd 100644
--- a/lib/irb/cmd/help.rb
+++ b/lib/irb/cmd/help.rb
@@ -1,6 +1,6 @@
#
# help.rb - helper using ri
-# $Release Version: 0.9.5$
+# $Release Version: 0.9.6$
# $Revision$
#
# --
diff --git a/lib/irb/cmd/load.rb b/lib/irb/cmd/load.rb
index 5988b7b..2a6de21 100644
--- a/lib/irb/cmd/load.rb
+++ b/lib/irb/cmd/load.rb
@@ -1,6 +1,6 @@
#
# load.rb -
-# $Release Version: 0.9.5$
+# $Release Version: 0.9.6$
# $Revision$
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
diff --git a/lib/irb/cmd/nop.rb b/lib/irb/cmd/nop.rb
index 873c0f4..2b02897 100644
--- a/lib/irb/cmd/nop.rb
+++ b/lib/irb/cmd/nop.rb
@@ -1,6 +1,6 @@
#
# nop.rb -
-# $Release Version: 0.9.5$
+# $Release Version: 0.9.6$
# $Revision$
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
diff --git a/lib/irb/cmd/pushws.rb b/lib/irb/cmd/pushws.rb
index a82939f..5fd5677 100644
--- a/lib/irb/cmd/pushws.rb
+++ b/lib/irb/cmd/pushws.rb
@@ -1,6 +1,6 @@
#
# change-ws.rb -
-# $Release Version: 0.9.5$
+# $Release Version: 0.9.6$
# $Revision$
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
diff --git a/lib/irb/cmd/subirb.rb b/lib/irb/cmd/subirb.rb
index eea6330..4d54a72 100644
--- a/lib/irb/cmd/subirb.rb
+++ b/lib/irb/cmd/subirb.rb
@@ -1,5 +1,5 @@
# multi.rb -
-# $Release Version: 0.9.5$
+# $Release Version: 0.9.6$
# $Revision$
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
diff --git a/lib/irb/context.rb b/lib/irb/context.rb
index a3f5e5a..a2778f7 100644
--- a/lib/irb/context.rb
+++ b/lib/irb/context.rb
@@ -1,6 +1,6 @@
#
# irb/context.rb - irb context
-# $Release Version: 0.9.5$
+# $Release Version: 0.9.6$
# $Revision$
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
@@ -9,6 +9,7 @@
#
#
require "irb/workspace"
+require "irb/inspector"
module IRB
class Context
@@ -34,8 +35,8 @@ module IRB
@load_modules = IRB.conf[:LOAD_MODULES]
@use_readline = IRB.conf[:USE_READLINE]
- @inspect_mode = IRB.conf[:INSPECT_MODE]
+ self.inspect_mode = IRB.conf[:INSPECT_MODE]
self.math_mode = IRB.conf[:MATH_MODE] if IRB.conf[:MATH_MODE]
self.use_tracer = IRB.conf[:USE_TRACER] if IRB.conf[:USE_TRACER]
self.use_loader = IRB.conf[:USE_LOADER] if IRB.conf[:USE_LOADER]
@@ -189,15 +190,49 @@ module IRB
end
def inspect_mode=(opt)
- if opt
+
+ if i = INSPECTORS[opt]
@inspect_mode = opt
+ @inspect_method = i
+ i.init
else
- @inspect_mode = !@inspect_mode
+ case opt
+ when nil
+ if INSPECTORS.keys_with_inspector(INSPECTORS[true]).include?(@inspect_mode)
+ self.inspect_mode = false
+ elsif INSPECTORS.keys_with_inspector(INSPECTORS[false]).include?(@inspect_mode)
+ self.inspect_mode = true
+ else
+ puts "Can't switch inspect mode."
+ return
+ end
+ when /^\s*\{.*\}\s*$/
+ begin
+ inspector = eval "proc#{opt}"
+ rescue Exception
+ puts "Can't switch inspect mode(#{opt})."
+ return
+ end
+ self.inspect_mode = inspector
+ when Proc
+ self.inspect_mode = IRB::Inspector(opt)
+ when Inspector
+ prefix = "usr%d"
+ i = 1
+ while INSPECTORS[format(prefix, i)]; i += 1; end
+ @inspect_mode = format(prefix, i)
+ @inspect_method = opt
+ INSPECTORS.def_inspector(format(prefix, i), @inspect_method)
+ else
+ puts "Can't switch inspect mode(#{opt})."
+ return
+ end
end
print "Switch to#{unless @inspect_mode; ' non';end} inspect mode.\n" if verbose?
@inspect_mode
end
+
def use_readline=(opt)
@use_readline = opt
print "use readline module\n" if @use_readline
@@ -220,6 +255,10 @@ module IRB
# @_ = @workspace.evaluate(line, irb_path, line_no)
end
+ def inspect_last_value
+ @inspect_method.inspect_value(@last_value)
+ end
+
alias __exit__ exit
def exit(ret = 0)
IRB.irb_exit(@irb, ret)
diff --git a/lib/irb/ext/change-ws.rb b/lib/irb/ext/change-ws.rb
index 3ae1eab..dea969d 100644
--- a/lib/irb/ext/change-ws.rb
+++ b/lib/irb/ext/change-ws.rb
@@ -1,6 +1,6 @@
#
# irb/ext/cb.rb -
-# $Release Version: 0.9.5$
+# $Release Version: 0.9.6$
# $Revision$
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
diff --git a/lib/irb/ext/history.rb b/lib/irb/ext/history.rb
index 9142146..1495f9e 100644
--- a/lib/irb/ext/history.rb
+++ b/lib/irb/ext/history.rb
@@ -1,6 +1,6 @@
#
# history.rb -
-# $Release Version: 0.9.5$
+# $Release Version: 0.9.6$
# $Revision$
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
diff --git a/lib/irb/ext/loader.rb b/lib/irb/ext/loader.rb
index cee8f51..26a3203 100644
--- a/lib/irb/ext/loader.rb
+++ b/lib/irb/ext/loader.rb
@@ -1,6 +1,6 @@
#
# loader.rb -
-# $Release Version: 0.9.5$
+# $Release Version: 0.9.6$
# $Revision$
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
diff --git a/lib/irb/ext/math-mode.rb b/lib/irb/ext/math-mode.rb
index 370fab2..41be798 100644
--- a/lib/irb/ext/math-mode.rb
+++ b/lib/irb/ext/math-mode.rb
@@ -1,6 +1,6 @@
#
# math-mode.rb -
-# $Release Version: 0.9.5$
+# $Release Version: 0.9.6$
# $Revision$
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
diff --git a/lib/irb/ext/multi-irb.rb b/lib/irb/ext/multi-irb.rb
index 5085a3f..7bb1a7c 100644
--- a/lib/irb/ext/multi-irb.rb
+++ b/lib/irb/ext/multi-irb.rb
@@ -1,6 +1,6 @@
#
# irb/multi-irb.rb - multiple irb module
-# $Release Version: 0.9.5$
+# $Release Version: 0.9.6$
# $Revision$
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
diff --git a/lib/irb/ext/save-history.rb b/lib/irb/ext/save-history.rb
index 72c6b57..e3597c6 100644
--- a/lib/irb/ext/save-history.rb
+++ b/lib/irb/ext/save-history.rb
@@ -1,5 +1,5 @@
# save-history.rb -
-# $Release Version: 0.9.5$
+# $Release Version: 0.9.6$
# $Revision$
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
diff --git a/lib/irb/ext/tracer.rb b/lib/irb/ext/tracer.rb
index 6728c46..46a9d53 100644
--- a/lib/irb/ext/tracer.rb
+++ b/lib/irb/ext/tracer.rb
@@ -1,6 +1,6 @@
#
# irb/lib/tracer.rb -
-# $Release Version: 0.9.5$
+# $Release Version: 0.9.6$
# $Revision$
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
diff --git a/lib/irb/ext/use-loader.rb b/lib/irb/ext/use-loader.rb
index b643dd0..64283b8 100644
--- a/lib/irb/ext/use-loader.rb
+++ b/lib/irb/ext/use-loader.rb
@@ -1,6 +1,6 @@
#
# use-loader.rb -
-# $Release Version: 0.9.5$
+# $Release Version: 0.9.6$
# $Revision$
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
diff --git a/lib/irb/ext/workspaces.rb b/lib/irb/ext/workspaces.rb
index 654b811..118ea59 100644
--- a/lib/irb/ext/workspaces.rb
+++ b/lib/irb/ext/workspaces.rb
@@ -1,6 +1,6 @@
#
# push-ws.rb -
-# $Release Version: 0.9.5$
+# $Release Version: 0.9.6$
# $Revision$
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
diff --git a/lib/irb/extend-command.rb b/lib/irb/extend-command.rb
index 61a43e4..7bc033c 100644
--- a/lib/irb/extend-command.rb
+++ b/lib/irb/extend-command.rb
@@ -1,6 +1,6 @@
#
# irb/extend-command.rb - irb extend command
-# $Release Version: 0.9.5$
+# $Release Version: 0.9.6$
# $Revision$
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
diff --git a/lib/irb/help.rb b/lib/irb/help.rb
index cae9c8a..4a308b6 100644
--- a/lib/irb/help.rb
+++ b/lib/irb/help.rb
@@ -1,6 +1,6 @@
#
# irb/help.rb - print usage module
-# $Release Version: 0.9.5$
+# $Release Version: 0.9.6$
# $Revision$
# by Keiju ISHITSUKA(keiju@ishitsuka.com)
#
diff --git a/lib/irb/init.rb b/lib/irb/init.rb
index 8f88802..489850a 100644
--- a/lib/irb/init.rb
+++ b/lib/irb/init.rb
@@ -1,6 +1,6 @@
#
# irb/init.rb - irb initialize module
-# $Release Version: 0.9.5$
+# $Release Version: 0.9.6$
# $Revision$
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
@@ -44,7 +44,7 @@ module IRB
@CONF[:MATH_MODE] = false
@CONF[:USE_READLINE] = false unless defined?(ReadlineInputMethod)
- @CONF[:INSPECT_MODE] = nil
+ @CONF[:INSPECT_MODE] = true
@CONF[:USE_TRACER] = false
@CONF[:USE_LOADER] = false
@CONF[:IGNORE_SIGINT] = true
@@ -145,7 +145,11 @@ module IRB
opt = $1 || ARGV.shift
set_encoding(*opt.split(':', 2))
when "--inspect"
- @CONF[:INSPECT_MODE] = true
+ if /^-/ !~ ARGV.first
+ @CONF[:INSPECT_MODE] = ARGV.shift
+ else
+ @CONF[:INSPECT_MODE] = true
+ end
when "--noinspect"
@CONF[:INSPECT_MODE] = false
when "--readline"
diff --git a/lib/irb/input-method.rb b/lib/irb/input-method.rb
index 9c3d682..7227df4 100644
--- a/lib/irb/input-method.rb
+++ b/lib/irb/input-method.rb
@@ -1,6 +1,6 @@
#
# irb/input-method.rb - input methods used irb
-# $Release Version: 0.9.5$
+# $Release Version: 0.9.6$
# $Revision$
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
diff --git a/lib/irb/lc/error.rb b/lib/irb/lc/error.rb
index ed7d036..742821e 100644
--- a/lib/irb/lc/error.rb
+++ b/lib/irb/lc/error.rb
@@ -1,6 +1,6 @@
#
# irb/lc/error.rb -
-# $Release Version: 0.9.5$
+# $Release Version: 0.9.6$
# $Revision$
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
diff --git a/lib/irb/lc/help-message b/lib/irb/lc/help-message
index 9c08a5c..dd30b9f 100644
--- a/lib/irb/lc/help-message
+++ b/lib/irb/lc/help-message
@@ -1,7 +1,7 @@
# -*- coding: US-ASCII -*-
#
# irb/lc/help-message.rb -
-# $Release Version: 0.9.5$
+# $Release Version: 0.9.6$
# $Revision$
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
diff --git a/lib/irb/lc/ja/error.rb b/lib/irb/lc/ja/error.rb
index c73b640..9a7670f 100644
--- a/lib/irb/lc/ja/error.rb
+++ b/lib/irb/lc/ja/error.rb
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# irb/lc/ja/error.rb -
-# $Release Version: 0.9.5$
+# $Release Version: 0.9.6$
# $Revision$
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
diff --git a/lib/irb/lc/ja/help-message b/lib/irb/lc/ja/help-message
index d156039..f2c4066 100644
--- a/lib/irb/lc/ja/help-message
+++ b/lib/irb/lc/ja/help-message
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# irb/lc/ja/help-message.rb -
-# $Release Version: 0.9.5$
+# $Release Version: 0.9.6$
# $Revision$
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
diff --git a/lib/irb/locale.rb b/lib/irb/locale.rb
index 9c96d15..9924409 100644
--- a/lib/irb/locale.rb
+++ b/lib/irb/locale.rb
@@ -1,6 +1,6 @@
#
# irb/locale.rb - internationalization module
-# $Release Version: 0.9.5$
+# $Release Version: 0.9.6$
# $Revision$
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
@@ -141,7 +141,7 @@ module IRB
dir = File.dirname(file)
dir = "" if dir == "."
base = File.basename(file)
- if dir[0] == ?/ #/
+ if dir =~ /^\//
return lc_path = search_file(dir, base)
else
for path in $:
diff --git a/lib/irb/notifier.rb b/lib/irb/notifier.rb
index f76fc80..fdfcdd2 100644
--- a/lib/irb/notifier.rb
+++ b/lib/irb/notifier.rb
@@ -1,6 +1,6 @@
#
# notifier.rb - output methods used by irb
-# $Release Version: 0.9.5$
+# $Release Version: 0.9.6$
# $Revision$
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
diff --git a/lib/irb/output-method.rb b/lib/irb/output-method.rb
index bbfc072..4201523 100644
--- a/lib/irb/output-method.rb
+++ b/lib/irb/output-method.rb
@@ -1,6 +1,6 @@
#
# output-method.rb - optput methods used by irb
-# $Release Version: 0.9.5$
+# $Release Version: 0.9.6$
# $Revision$
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
diff --git a/lib/irb/ruby-lex.rb b/lib/irb/ruby-lex.rb
index 1def148..b36629b 100644
--- a/lib/irb/ruby-lex.rb
+++ b/lib/irb/ruby-lex.rb
@@ -1,6 +1,6 @@
#
# irb/ruby-lex.rb - ruby lexcal analyzer
-# $Release Version: 0.9.5$
+# $Release Version: 0.9.6$
# $Revision$
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
diff --git a/lib/irb/ruby-token.rb b/lib/irb/ruby-token.rb
index 9eb3bc1..9b06eab 100644
--- a/lib/irb/ruby-token.rb
+++ b/lib/irb/ruby-token.rb
@@ -1,6 +1,6 @@
#
# irb/ruby-token.rb - ruby tokens
-# $Release Version: 0.9.5$
+# $Release Version: 0.9.6$
# $Revision$
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
diff --git a/lib/irb/slex.rb b/lib/irb/slex.rb
index 6b3d1f3..fac62bf 100644
--- a/lib/irb/slex.rb
+++ b/lib/irb/slex.rb
@@ -1,6 +1,6 @@
#
# irb/slex.rb - simple lex analyzer
-# $Release Version: 0.9.5$
+# $Release Version: 0.9.6$
# $Revision$
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
diff --git a/lib/irb/version.rb b/lib/irb/version.rb
index a9ccc1c..621a127 100644
--- a/lib/irb/version.rb
+++ b/lib/irb/version.rb
@@ -1,6 +1,6 @@
#
# irb/version.rb - irb version definition file
-# $Release Version: 0.9.5$
+# $Release Version: 0.9.6$
# $Revision$
# by Keiju ISHITSUKA(keiju@ishitsuka.com)
#
@@ -10,6 +10,6 @@
#
module IRB
- @RELEASE_VERSION = "0.9.5"
- @LAST_UPDATE_DATE = "05/04/13"
+ @RELEASE_VERSION = "0.9.6"
+ @LAST_UPDATE_DATE = "09/06/30"
end
diff --git a/lib/irb/workspace.rb b/lib/irb/workspace.rb
index 1b88914..991df2e 100644
--- a/lib/irb/workspace.rb
+++ b/lib/irb/workspace.rb
@@ -1,6 +1,6 @@
#
# irb/workspace-binding.rb -
-# $Release Version: 0.9.5$
+# $Release Version: 0.9.6$
# $Revision$
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
diff --git a/lib/irb/ws-for-case-2.rb b/lib/irb/ws-for-case-2.rb
index d7db90c..bb3932a 100644
--- a/lib/irb/ws-for-case-2.rb
+++ b/lib/irb/ws-for-case-2.rb
@@ -1,6 +1,6 @@
#
# irb/ws-for-case-2.rb -
-# $Release Version: 0.9.5$
+# $Release Version: 0.9.6$
# $Revision$
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#