ruby-changes:15989
From: wyhaines <ko1@a...>
Date: Fri, 21 May 2010 04:37:08 +0900 (JST)
Subject: [ruby-changes:15989] Ruby:r27934 (ruby_1_8_6): Backport #145 ; Fixes some misleading exceptions in IRB's fg command when used with no arguments or invalid arguments.
wyhaines 2010-05-21 04:36:52 +0900 (Fri, 21 May 2010) New Revision: 27934 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=27934 Log: Backport #145 [ruby-dev:35075]; Fixes some misleading exceptions in IRB's fg command when used with no arguments or invalid arguments. Modified files: branches/ruby_1_8_6/ChangeLog branches/ruby_1_8_6/lib/irb/ext/multi-irb.rb branches/ruby_1_8_6/lib/irb/extend-command.rb Index: ruby_1_8_6/ChangeLog =================================================================== --- ruby_1_8_6/ChangeLog (revision 27933) +++ ruby_1_8_6/ChangeLog (revision 27934) @@ -1,3 +1,10 @@ +Thu May 20 04:10:00 2010 Kirk Haines <khaines@r...> + + * lib/cgi.rb: Backport #229 [ruby-core:17634]; CGI::Cookie objects can get out of sync when CGI::Cookie#value= is used to assign a new value. Also, if a nil value ends up in the array of values for the cookie, CGI::Cookie#to_s would blow up on a gsub error when it tried to CGI::escape the nil value. This is fixed so that nils are treated as empty strings. + + * lib/irb/ext/multi-irb.rb: Backport #145 [ruby-dev:35075]; Fixes some misleading exceptions in IRB's fg command when used with no arguments or invalid arguments. + * lib/irb/extended-command.rb: Backport #145 [ruby-dev:35075] + Fri Mar 5 03:58:00 2010 Kirk Haines <khaines@r...> * lib/yaml/tag.rb: Add a :startdoc: at the end of the YAML specific Module functions so that the rest of the Module docs get generated. Fixes Bug #1718 [ruby-core:24121]. Index: ruby_1_8_6/lib/irb/ext/multi-irb.rb =================================================================== --- ruby_1_8_6/lib/irb/ext/multi-irb.rb (revision 27933) +++ ruby_1_8_6/lib/irb/ext/multi-irb.rb (revision 27934) @@ -70,7 +70,7 @@ end def search(key) - case key + job = case key when Integer @jobs[key] when Irb @@ -78,10 +78,10 @@ when Thread @jobs.assoc(key) else - assoc = @jobs.find{|k, v| v.context.main.equal?(key)} - IRB.fail NoSuchJob, key if assoc.nil? - assoc + @jobs.find{|k, v| v.context.main.equal?(key)} end + IRB.fail NoSuchJob, key if job.nil? + job end def delete(key) Index: ruby_1_8_6/lib/irb/extend-command.rb =================================================================== --- ruby_1_8_6/lib/irb/extend-command.rb (revision 27933) +++ ruby_1_8_6/lib/irb/extend-command.rb (revision 27934) @@ -126,9 +126,15 @@ eval %[ def #{cmd_name}(*opts, &b) require "#{load_file}" + arity = ExtendCommand::#{cmd_class}.instance_method(:execute).arity + args = (1..arity.abs).map {|i| "arg" + i.to_s } + args << "*opts" if arity < 0 + args << "&block" + args = args.join(", ") eval %[ - def #{cmd_name}(*opts, &b) - ExtendCommand::#{cmd_class}.execute(irb_context, *opts, &b) + def #{cmd_name}(\#{args}) + ExtendCommand::#{cmd_class}.execute(irb_context, \#{args}) + end ] send :#{cmd_name}, *opts, &b -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/