Skip to content

Commit

Permalink
* bin/irb lib/irb.rb lib/irb/...: IRB 0.9.5.
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8322 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
keiju authored and aycabta committed Jun 5, 2019
1 parent 3dba80c commit 6cc5d71
Show file tree
Hide file tree
Showing 32 changed files with 443 additions and 319 deletions.
4 changes: 2 additions & 2 deletions bin/irb
@@ -1,10 +1,10 @@
#!/usr/bin/env ruby
#
# irb.rb - intaractive ruby
# $Release Version: 0.7.3 $
# $Release Version: 0.9.5 $
# $Revision$
# $Date$
# by Keiju ISHITSUKA(keiju@ishitsuka.com)
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#

require "irb"
Expand Down
10 changes: 6 additions & 4 deletions lib/irb.rb
@@ -1,9 +1,9 @@
#
# irb.rb - irb main module
# $Release Version: 0.9 $
# $Release Version: 0.9.5 $
# $Revision$
# $Date$
# by Keiju ISHITSUKA(keiju@ishitsuka.com)
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
# --
#
Expand Down Expand Up @@ -88,8 +88,8 @@ def IRB.irb_abort(irb, exception = Abort)
# irb interpriter main routine
#
class Irb
def initialize(workspace = nil, input_method = nil)
@context = Context.new(self, workspace, input_method)
def initialize(workspace = nil, input_method = nil, output_method = nil)
@context = Context.new(self, workspace, input_method, output_method)
@context.main.extend ExtendCommandBundle
@signal_status = :IN_IRB

Expand All @@ -106,6 +106,8 @@ def eval_input
f = @context.prompt_s
elsif continue
f = @context.prompt_c
elsif indent > 0
f = @context.prompt_n
else @context.prompt_i
f = @context.prompt_i
end
Expand Down
4 changes: 2 additions & 2 deletions lib/irb/cmd/chws.rb
@@ -1,9 +1,9 @@
#
# change-ws.rb -
# $Release Version: 0.9$
# $Release Version: 0.9.5$
# $Revision$
# $Date$
# by Keiju ISHITSUKA(Nihon Rational Software Co.,Ltd)
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
# --
#
Expand Down
16 changes: 15 additions & 1 deletion lib/irb/cmd/fork.rb
@@ -1,9 +1,23 @@
#
# fork.rb -
# $Release Version: 0.9.5 $
# $Revision$
# $Date$
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
# --
#
#
#

@RCS_ID='-$Id$-'


module IRB
module ExtendCommand
class Fork<Nop
def execute(&block)
pid = send(ExtendCommand.irb_original_method_name("fork"))
pid = send ExtendCommand.irb_original_method_name("fork")
unless pid
class<<self
alias_method :exit, ExtendCommand.irb_original_method_name('exit')
Expand Down
4 changes: 2 additions & 2 deletions lib/irb/cmd/load.rb
@@ -1,9 +1,9 @@
#
# load.rb -
# $Release Version: 0.9$
# $Release Version: 0.9.5$
# $Revision$
# $Date$
# by Keiju ISHITSUKA(Nihon Rational Software Co.,Ltd)
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
# --
#
Expand Down
4 changes: 2 additions & 2 deletions lib/irb/cmd/nop.rb
@@ -1,9 +1,9 @@
#
# nop.rb -
# $Release Version: 0.9$
# $Release Version: 0.9.5$
# $Revision$
# $Date$
# by Keiju ISHITSUKA(Nihon Rational Software Co.,Ltd)
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
# --
#
Expand Down
4 changes: 2 additions & 2 deletions lib/irb/cmd/pushws.rb
@@ -1,9 +1,9 @@
#
# change-ws.rb -
# $Release Version: 0.9$
# $Release Version: 0.9.5$
# $Revision$
# $Date$
# by Keiju ISHITSUKA(Nihon Rational Software Co.,Ltd)
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
# --
#
Expand Down
4 changes: 2 additions & 2 deletions lib/irb/cmd/subirb.rb
@@ -1,10 +1,10 @@
#!/usr/local/bin/ruby
#
# multi.rb -
# $Release Version: 0.9$
# $Release Version: 0.9.5$
# $Revision$
# $Date$
# by Keiju ISHITSUKA(Nihon Rational Software Co.,Ltd)
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
# --
#
Expand Down
19 changes: 14 additions & 5 deletions lib/irb/context.rb
@@ -1,9 +1,9 @@
#
# irb/context.rb - irb context
# $Release Version: 0.9$
# $Release Version: 0.9.5$
# $Revision$
# $Date$
# by Keiju ISHITSUKA(keiju@ishitsuka.com)
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
# --
#
Expand All @@ -19,7 +19,7 @@ class Context
# String -- File
# other -- using this as InputMethod
#
def initialize(irb, workspace = nil, input_method = nil)
def initialize(irb, workspace = nil, input_method = nil, output_method = nil)
@irb = irb
if workspace
@workspace = workspace
Expand Down Expand Up @@ -71,6 +71,13 @@ def initialize(irb, workspace = nil, input_method = nil)
else
@io = input_method
end
self.save_history = IRB.conf[:SAVE_HISTORY] if IRB.conf[:SAVE_HISTORY]

if output_method
@output_method = output_method
else
@output_method = StdioOutputMethod.new
end

@verbose = IRB.conf[:VERBOSE]
@echo = IRB.conf[:ECHO]
Expand All @@ -96,13 +103,14 @@ def main
attr_accessor :irb_name
attr_accessor :irb_path

attr_accessor :use_readline
attr_reader :use_readline
attr_reader :inspect_mode

attr_reader :prompt_mode
attr_accessor :prompt_i
attr_accessor :prompt_s
attr_accessor :prompt_c
attr_accessor :prompt_n
attr_accessor :auto_indent_mode
attr_accessor :return_format

Expand Down Expand Up @@ -141,6 +149,7 @@ def prompting?

def set_last_value(value)
@last_value = value
@workspace.evaluate self, "_ = IRB.CurrentContext.last_value"
end

attr_reader :irb_name
Expand All @@ -151,6 +160,7 @@ def prompt_mode=(mode)
@prompt_i = pconf[:PROMPT_I]
@prompt_s = pconf[:PROMPT_S]
@prompt_c = pconf[:PROMPT_C]
@prompt_n = pconf[:PROMPT_N]
@return_format = pconf[:RETURN]
if ai = pconf.include?(:AUTO_INDENT)
@auto_indent_mode = ai
Expand All @@ -177,7 +187,6 @@ def inspect_mode=(opt)
@inspect_mode
end

undef use_readline=
def use_readline=(opt)
@use_readline = opt
print "use readline module\n" if @use_readline
Expand Down
4 changes: 2 additions & 2 deletions lib/irb/ext/change-ws.rb
@@ -1,9 +1,9 @@
#
# irb/ext/cb.rb -
# $Release Version: 0.9$
# $Release Version: 0.9.5$
# $Revision$
# $Date$
# by Keiju ISHITSUKA(Nihon Rational Software Co.,Ltd)
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
# --
#
Expand Down
10 changes: 5 additions & 5 deletions lib/irb/ext/history.rb
@@ -1,9 +1,9 @@
#
# history.rb -
# $Release Version: 0.9$
# $Release Version: 0.9.5$
# $Revision$
# $Date$
# by Keiju ISHITSUKA(Nihon Rational Software Co.,Ltd)
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
# --
#
Expand All @@ -21,8 +21,8 @@ class Context
def set_last_value(value)
_set_last_value(value)

@workspace.evaluate self, "_ = IRB.CurrentContext.last_value"
if (@eval_history ||= nil) #and !@eval_history_values.equal?(llv)
# @workspace.evaluate self, "_ = IRB.CurrentContext.last_value"
if @eval_history #and !@eval_history_values.equal?(llv)
@eval_history_values.push @line_no, @last_value
@workspace.evaluate self, "__ = IRB.CurrentContext.instance_eval{@eval_history_values}"
end
Expand All @@ -33,7 +33,7 @@ def set_last_value(value)
attr_reader :eval_history
def eval_history=(no)
if no
if (@eval_history ||= nil)
if @eval_history
@eval_history_values.size(no)
else
@eval_history_values = History.new(no)
Expand Down
15 changes: 15 additions & 0 deletions lib/irb/ext/loader.rb
@@ -1,3 +1,18 @@
#
# loader.rb -
# $Release Version: 0.9.5$
# $Revision$
# $Date$
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
# --
#
#
#

@RCS_ID='-$Id$-'


module IRB
class LoadAbort < Exception;end

Expand Down
4 changes: 2 additions & 2 deletions lib/irb/ext/math-mode.rb
@@ -1,9 +1,9 @@
#
# math-mode.rb -
# $Release Version: 0.9$
# $Release Version: 0.9.5$
# $Revision$
# $Date$
# by Keiju ISHITSUKA(Nihon Rational Software Co.,Ltd)
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
# --
#
Expand Down
4 changes: 2 additions & 2 deletions lib/irb/ext/multi-irb.rb
@@ -1,9 +1,9 @@
#
# irb/multi-irb.rb - multiple irb module
# $Release Version: 0.9$
# $Release Version: 0.9.5$
# $Revision$
# $Date$
# by Keiju ISHITSUKA(keiju@ishitsuka.com)
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
# --
#
Expand Down
4 changes: 2 additions & 2 deletions lib/irb/ext/tracer.rb
@@ -1,9 +1,9 @@
#
# irb/lib/tracer.rb -
# $Release Version: 0.9$
# $Release Version: 0.9.5$
# $Revision$
# $Date$
# by Keiju ISHITSUKA(Nihon Rational Software Co.,Ltd)
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
# --
#
Expand Down
4 changes: 2 additions & 2 deletions lib/irb/ext/use-loader.rb
@@ -1,9 +1,9 @@
#
# use-loader.rb -
# $Release Version: 0.9$
# $Release Version: 0.9.5$
# $Revision$
# $Date$
# by Keiju ISHITSUKA(Nihon Rational Software Co.,Ltd)
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
# --
#
Expand Down
4 changes: 2 additions & 2 deletions lib/irb/ext/workspaces.rb
@@ -1,9 +1,9 @@
#
# push-ws.rb -
# $Release Version: 0.9$
# $Release Version: 0.9.5$
# $Revision$
# $Date$
# by Keiju ISHITSUKA(Nihon Rational Software Co.,Ltd)
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
# --
#
Expand Down

0 comments on commit 6cc5d71

Please sign in to comment.