зеркало из https://github.com/github/ruby.git
* lib/irb/extend-command.rb (def_extend_command): check number of
arguments. [ruby-dev:35074] * lib/irb/ext/multi-irb.rb (search): check if a corresponding job is found. [ruby-dev:35074] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18837 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
4da80c7d6b
Коммит
cba52ec37c
|
@ -1,3 +1,11 @@
|
|||
Mon Aug 25 22:39:57 2008 Yusuke Endoh <mame@tsg.ne.jp>
|
||||
|
||||
* lib/irb/extend-command.rb (def_extend_command): check number of
|
||||
arguments. [ruby-dev:35074]
|
||||
|
||||
* lib/irb/ext/multi-irb.rb (search): check if a corresponding job is
|
||||
found. [ruby-dev:35074]
|
||||
|
||||
Mon Aug 25 22:29:13 2008 Yusuke Endoh <mame@tsg.ne.jp>
|
||||
|
||||
* test/ruby/test_io.rb (test_dup): fix typo. see [ruby-dev:35958]
|
||||
|
|
|
@ -69,7 +69,7 @@ module IRB
|
|||
end
|
||||
|
||||
def search(key)
|
||||
case key
|
||||
job = case key
|
||||
when Integer
|
||||
@jobs[key]
|
||||
when Irb
|
||||
|
@ -77,10 +77,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)
|
||||
|
|
|
@ -125,9 +125,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
|
||||
|
|
Загрузка…
Ссылка в новой задаче