ruby-changes:35038
From: hsbt <ko1@a...>
Date: Sun, 10 Aug 2014 10:05:23 +0900 (JST)
Subject: [ruby-changes:35038] hsbt:r47120 (trunk): * lib/irb/ext/multi-irb.rb: fixed indent.
hsbt 2014-08-10 10:05:08 +0900 (Sun, 10 Aug 2014) New Revision: 47120 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=47120 Log: * lib/irb/ext/multi-irb.rb: fixed indent. * lib/irb/output-method.rb: ditto. Modified files: trunk/lib/irb/ext/multi-irb.rb trunk/lib/irb/output-method.rb Index: lib/irb/output-method.rb =================================================================== --- lib/irb/output-method.rb (revision 47119) +++ lib/irb/output-method.rb (revision 47120) @@ -35,7 +35,7 @@ module IRB https://github.com/ruby/ruby/blob/trunk/lib/irb/output-method.rb#L35 # #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 https://github.com/ruby/ruby/blob/trunk/lib/irb/output-method.rb#L58 # character. def puts(*objs) for obj in objs - print(*obj) - print "\n" + print(*obj) + print "\n" end end Index: lib/irb/ext/multi-irb.rb =================================================================== --- lib/irb/ext/multi-irb.rb (revision 47119) +++ lib/irb/ext/multi-irb.rb (revision 47120) @@ -84,9 +84,9 @@ module IRB https://github.com/ruby/ruby/blob/trunk/lib/irb/ext/multi-irb.rb#L84 # 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 https://github.com/ruby/ruby/blob/trunk/lib/irb/ext/multi-irb.rb#L106 # 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 https://github.com/ruby/ruby/blob/trunk/lib/irb/ext/multi-irb.rb#L123 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 https://github.com/ruby/ruby/blob/trunk/lib/irb/ext/multi-irb.rb#L147 def inspect ary = [] @jobs.each_index do - |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) + |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) end ary.join("\n") end @@ -192,39 +192,39 @@ module IRB https://github.com/ruby/ruby/blob/trunk/lib/irb/ext/multi-irb.rb#L192 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/