diff options
author | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-11-17 06:51:29 +0000 |
---|---|---|
committer | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-11-17 06:51:29 +0000 |
commit | 29929d799d4da41a177feba7e0735b6b571dfa45 (patch) | |
tree | f34ad1de2e59129df3bc8844fd5d944f839ce706 | |
parent | d9abe0513d913b1eb6e149ad9f610a694385e226 (diff) |
merge revision(s) 24911:
* lib/irb/ext/multi-irb.rb: Fix arguments handling for shell commands
in irb; a patch by Yusuke Endoh [ruby-dev:35075]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@25814 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | lib/irb/ext/multi-irb.rb | 8 | ||||
-rw-r--r-- | lib/irb/extend-command.rb | 9 | ||||
-rw-r--r-- | version.h | 2 |
4 files changed, 17 insertions, 7 deletions
@@ -1,3 +1,8 @@ +Tue Nov 17 15:49:00 2009 Marc-Andre Lafortune <ruby-core@marc-andre.ca> + + * lib/irb/ext/multi-irb.rb: Fix arguments handling for shell commands + in irb; a patch by Yusuke Endoh [ruby-dev:35075] + Tue Nov 17 15:32:27 2009 Nobuyoshi Nakada <nobu@ruby-lang.org> * io.c (rb_io_binmode): check if closed regardless platforms. diff --git a/lib/irb/ext/multi-irb.rb b/lib/irb/ext/multi-irb.rb index 4589b1d554..634abbabf9 100644 --- a/lib/irb/ext/multi-irb.rb +++ b/lib/irb/ext/multi-irb.rb @@ -70,7 +70,7 @@ module IRB end def search(key) - case key + job = case key when Integer @jobs[key] when Irb @@ -78,10 +78,10 @@ module IRB 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) diff --git a/lib/irb/extend-command.rb b/lib/irb/extend-command.rb index 508721c11d..de797ab78b 100644 --- a/lib/irb/extend-command.rb +++ b/lib/irb/extend-command.rb @@ -126,9 +126,14 @@ module IRB 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 @@ -2,7 +2,7 @@ #define RUBY_RELEASE_DATE "2009-11-17" #define RUBY_VERSION_CODE 187 #define RUBY_RELEASE_CODE 20091117 -#define RUBY_PATCHLEVEL 207 +#define RUBY_PATCHLEVEL 208 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 8 |