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>
|
Sun Sep 13 22:13:35 2009 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
* lib/tempfile.rb (Tempfile::Remover): new class to replace
|
* lib/tempfile.rb (Tempfile::Remover): new class to replace
|
||||||
|
|
|
@ -70,7 +70,7 @@ module IRB
|
||||||
end
|
end
|
||||||
|
|
||||||
def search(key)
|
def search(key)
|
||||||
case key
|
job = case key
|
||||||
when Integer
|
when Integer
|
||||||
@jobs[key]
|
@jobs[key]
|
||||||
when Irb
|
when Irb
|
||||||
|
@ -78,10 +78,10 @@ module IRB
|
||||||
when Thread
|
when Thread
|
||||||
@jobs.assoc(key)
|
@jobs.assoc(key)
|
||||||
else
|
else
|
||||||
assoc = @jobs.find{|k, v| v.context.main.equal?(key)}
|
@jobs.find{|k, v| v.context.main.equal?(key)}
|
||||||
IRB.fail NoSuchJob, key if assoc.nil?
|
|
||||||
assoc
|
|
||||||
end
|
end
|
||||||
|
IRB.fail NoSuchJob, key if job.nil?
|
||||||
|
job
|
||||||
end
|
end
|
||||||
|
|
||||||
def delete(key)
|
def delete(key)
|
||||||
|
|
|
@ -126,9 +126,14 @@ module IRB
|
||||||
eval %[
|
eval %[
|
||||||
def #{cmd_name}(*opts, &b)
|
def #{cmd_name}(*opts, &b)
|
||||||
require "#{load_file}"
|
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 %[
|
eval %[
|
||||||
def #{cmd_name}(*opts, &b)
|
def #{cmd_name}(\#{args})
|
||||||
ExtendCommand::#{cmd_class}.execute(irb_context, *opts, &b)
|
ExtendCommand::#{cmd_class}.execute(irb_context, \#{args})
|
||||||
end
|
end
|
||||||
]
|
]
|
||||||
send :#{cmd_name}, *opts, &b
|
send :#{cmd_name}, *opts, &b
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue