mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/irb/ext/multi-irb.rb: Fix arguments handling for shell commands in irb; a patch by Yusuke Endoh [ruby-dev:35075]
* lib/irb/extend-command.rb: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@24911 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
dab6f00eb6
commit
f2ef876138
3 changed files with 16 additions and 6 deletions
|
@ -1,3 +1,8 @@
|
|||
Mon Sep 14 04:57:27 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]
|
||||
|
||||
Sun Sep 13 22:13:35 2009 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* lib/tempfile.rb (Tempfile::Remover): new class to replace
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue