summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/irb/ext/multi-irb.rb8
-rw-r--r--lib/irb/extend-command.rb9
2 files changed, 11 insertions, 6 deletions
diff --git a/lib/irb/ext/multi-irb.rb b/lib/irb/ext/multi-irb.rb
index 9ad8f8b143..d32d41ff95 100644
--- a/lib/irb/ext/multi-irb.rb
+++ b/lib/irb/ext/multi-irb.rb
@@ -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)
diff --git a/lib/irb/extend-command.rb b/lib/irb/extend-command.rb
index 5cfae7ea3c..2816f35116 100644
--- a/lib/irb/extend-command.rb
+++ b/lib/irb/extend-command.rb
@@ -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