зеркало из https://github.com/github/ruby.git
* bin/irb, lib/irb.rb lib/irb/*: irb-0.9.6, extend inspect-mode
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23985 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
649237de8f
Коммит
c7fa0c727c
|
@ -1,3 +1,7 @@
|
|||
Tue Jul 7 20:23:27 2009 Keiju Ishitsuka <keiju@ruby-lang.org>
|
||||
|
||||
* bin/irb, lib/irb.rb lib/irb/*: irb-0.9.6, extend inspect-mode
|
||||
|
||||
Tue Jul 7 17:00:38 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* gc.c (rb_gc_call_finalizer_at_exit): deal with typed struct like
|
||||
|
|
2
bin/irb
2
bin/irb
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env ruby
|
||||
#
|
||||
# irb.rb - interactive ruby
|
||||
# $Release Version: 0.9.5 $
|
||||
# $Release Version: 0.9.6 $
|
||||
# $Revision$
|
||||
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
|
||||
#
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#
|
||||
# irb.rb - irb main module
|
||||
# $Release Version: 0.9.5 $
|
||||
# $Release Version: 0.9.6 $
|
||||
# $Revision$
|
||||
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
|
||||
#
|
||||
|
@ -298,11 +298,7 @@ module IRB
|
|||
end
|
||||
|
||||
def output_value
|
||||
if @context.inspect?
|
||||
printf @context.return_format, @context.last_value.inspect
|
||||
else
|
||||
printf @context.return_format, @context.last_value
|
||||
end
|
||||
printf @context.return_format, @context.inspect_last_value
|
||||
end
|
||||
|
||||
def inspect
|
||||
|
|
|
@ -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)
|
||||
#
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#
|
||||
# fork.rb -
|
||||
# $Release Version: 0.9.5 $
|
||||
# $Release Version: 0.9.6 $
|
||||
# $Revision$
|
||||
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
|
||||
#
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#
|
||||
# help.rb - helper using ri
|
||||
# $Release Version: 0.9.5$
|
||||
# $Release Version: 0.9.6$
|
||||
# $Revision$
|
||||
#
|
||||
# --
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#
|
||||
# load.rb -
|
||||
# $Release Version: 0.9.5$
|
||||
# $Release Version: 0.9.6$
|
||||
# $Revision$
|
||||
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
|
||||
#
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#
|
||||
# nop.rb -
|
||||
# $Release Version: 0.9.5$
|
||||
# $Release Version: 0.9.6$
|
||||
# $Revision$
|
||||
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
|
||||
#
|
||||
|
|
|
@ -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)
|
||||
#
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# multi.rb -
|
||||
# $Release Version: 0.9.5$
|
||||
# $Release Version: 0.9.6$
|
||||
# $Revision$
|
||||
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
|
||||
#
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
#
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#
|
||||
# history.rb -
|
||||
# $Release Version: 0.9.5$
|
||||
# $Release Version: 0.9.6$
|
||||
# $Revision$
|
||||
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
|
||||
#
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#
|
||||
# loader.rb -
|
||||
# $Release Version: 0.9.5$
|
||||
# $Release Version: 0.9.6$
|
||||
# $Revision$
|
||||
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
|
||||
#
|
||||
|
|
|
@ -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)
|
||||
#
|
||||
|
|
|
@ -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)
|
||||
#
|
||||
|
|
|
@ -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)
|
||||
#
|
||||
|
|
|
@ -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)
|
||||
#
|
||||
|
|
|
@ -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)
|
||||
#
|
||||
|
|
|
@ -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)
|
||||
#
|
||||
|
|
|
@ -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)
|
||||
#
|
||||
|
|
|
@ -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)
|
||||
#
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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)
|
||||
#
|
||||
|
|
|
@ -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)
|
||||
#
|
||||
|
|
|
@ -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)
|
||||
#
|
||||
|
|
|
@ -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)
|
||||
#
|
||||
|
|
|
@ -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)
|
||||
#
|
||||
|
|
|
@ -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 $:
|
||||
|
|
|
@ -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)
|
||||
#
|
||||
|
|
|
@ -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)
|
||||
#
|
||||
|
|
|
@ -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)
|
||||
#
|
||||
|
|
|
@ -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)
|
||||
#
|
||||
|
|
|
@ -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)
|
||||
#
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
#
|
||||
|
|
|
@ -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)
|
||||
#
|
||||
|
|
Загрузка…
Ссылка в новой задаче