summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-08-10 01:05:08 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-08-10 01:05:08 +0000
commit0b7979a8fd03b02a82b2dc1f1ef78ba431dfdc2d (patch)
tree760b5c6ea49f1ed139d41e7ec4fd774d6df72535 /lib
parentf9a81499ff72b920798d440d292a97e4809b14f4 (diff)
* lib/irb/ext/multi-irb.rb: fixed indent.
* lib/irb/output-method.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47120 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/irb/ext/multi-irb.rb138
-rw-r--r--lib/irb/output-method.rb6
2 files changed, 72 insertions, 72 deletions
diff --git a/lib/irb/ext/multi-irb.rb b/lib/irb/ext/multi-irb.rb
index d697b1ecbe..cd1ddd9f9f 100644
--- a/lib/irb/ext/multi-irb.rb
+++ b/lib/irb/ext/multi-irb.rb
@@ -84,9 +84,9 @@ module IRB
# See Thread#exit for more information.
def kill(*keys)
for key in keys
- th, _ = search(key)
- IRB.fail IrbAlreadyDead unless th.alive?
- th.exit
+ th, _ = search(key)
+ IRB.fail IrbAlreadyDead unless th.alive?
+ th.exit
end
end
@@ -106,15 +106,15 @@ module IRB
# Raises a NoSuchJob exception if no job can be found with the given +key+.
def search(key)
job = case key
- when Integer
- @jobs[key]
- when Irb
- @jobs.find{|k, v| v.equal?(key)}
- when Thread
- @jobs.assoc(key)
- else
- @jobs.find{|k, v| v.context.main.equal?(key)}
- end
+ when Integer
+ @jobs[key]
+ when Irb
+ @jobs.find{|k, v| v.equal?(key)}
+ when Thread
+ @jobs.assoc(key)
+ else
+ @jobs.find{|k, v| v.context.main.equal?(key)}
+ end
IRB.fail NoSuchJob, key if job.nil?
job
end
@@ -123,21 +123,21 @@ module IRB
def delete(key)
case key
when Integer
- IRB.fail NoSuchJob, key unless @jobs[key]
- @jobs[key] = nil
+ IRB.fail NoSuchJob, key unless @jobs[key]
+ @jobs[key] = nil
else
- catch(:EXISTS) do
- @jobs.each_index do
- |i|
- if @jobs[i] and (@jobs[i][0] == key ||
- @jobs[i][1] == key ||
- @jobs[i][1].context.main.equal?(key))
- @jobs[i] = nil
- throw :EXISTS
- end
- end
- IRB.fail NoSuchJob, key
- end
+ catch(:EXISTS) do
+ @jobs.each_index do
+ |i|
+ if @jobs[i] and (@jobs[i][0] == key ||
+ @jobs[i][1] == key ||
+ @jobs[i][1].context.main.equal?(key))
+ @jobs[i] = nil
+ throw :EXISTS
+ end
+ end
+ IRB.fail NoSuchJob, key
+ end
end
until assoc = @jobs.pop; end unless @jobs.empty?
@jobs.push assoc
@@ -147,25 +147,25 @@ module IRB
def inspect
ary = []
@jobs.each_index do
- |i|
- th, irb = @jobs[i]
- next if th.nil?
+ |i|
+ th, irb = @jobs[i]
+ next if th.nil?
- if th.alive?
- if th.stop?
- t_status = "stop"
- else
- t_status = "running"
- end
- else
- t_status = "exited"
- end
- ary.push format("#%d->%s on %s (%s: %s)",
- i,
- irb.context.irb_name,
- irb.context.main,
- th,
- t_status)
+ if th.alive?
+ if th.stop?
+ t_status = "stop"
+ else
+ t_status = "running"
+ end
+ else
+ t_status = "exited"
+ end
+ ary.push format("#%d->%s on %s (%s: %s)",
+ i,
+ irb.context.irb_name,
+ irb.context.main,
+ th,
+ t_status)
end
ary.join("\n")
end
@@ -192,39 +192,39 @@ module IRB
parent_thread = Thread.current
Thread.start do
begin
- irb = Irb.new(workspace, file)
+ irb = Irb.new(workspace, file)
rescue
- print "Subirb can't start with context(self): ", workspace.main.inspect, "\n"
- print "return to main irb\n"
- Thread.pass
- Thread.main.wakeup
- Thread.exit
+ print "Subirb can't start with context(self): ", workspace.main.inspect, "\n"
+ print "return to main irb\n"
+ Thread.pass
+ Thread.main.wakeup
+ Thread.exit
end
@CONF[:IRB_RC].call(irb.context) if @CONF[:IRB_RC]
@JobManager.insert(irb)
@JobManager.current_job = irb
begin
- system_exit = false
- catch(:IRB_EXIT) do
- irb.eval_input
- end
+ system_exit = false
+ catch(:IRB_EXIT) do
+ irb.eval_input
+ end
rescue SystemExit
- system_exit = true
- raise
- #fail
+ system_exit = true
+ raise
+ #fail
ensure
- unless system_exit
- @JobManager.delete(irb)
- if @JobManager.current_job == irb
- if parent_thread.alive?
- @JobManager.current_job = @JobManager.irb(parent_thread)
- parent_thread.run
- else
- @JobManager.current_job = @JobManager.main_irb
- @JobManager.main_thread.run
- end
- end
- end
+ unless system_exit
+ @JobManager.delete(irb)
+ if @JobManager.current_job == irb
+ if parent_thread.alive?
+ @JobManager.current_job = @JobManager.irb(parent_thread)
+ parent_thread.run
+ else
+ @JobManager.current_job = @JobManager.main_irb
+ @JobManager.main_thread.run
+ end
+ end
+ end
end
end
Thread.stop
diff --git a/lib/irb/output-method.rb b/lib/irb/output-method.rb
index aae9e2294d..e0ba25f3e4 100644
--- a/lib/irb/output-method.rb
+++ b/lib/irb/output-method.rb
@@ -35,7 +35,7 @@ module IRB
# #parse_printf_format
def printf(format, *opts)
if /(%*)%I/ =~ format
- format, opts = parse_printf_format(format, opts)
+ format, opts = parse_printf_format(format, opts)
end
print sprintf(format, *opts)
end
@@ -58,8 +58,8 @@ module IRB
# character.
def puts(*objs)
for obj in objs
- print(*obj)
- print "\n"
+ print(*obj)
+ print "\n"
end
end