summaryrefslogtreecommitdiff
path: root/lib/irb/extend-command.rb
diff options
context:
space:
mode:
authormame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-08-25 13:41:11 +0000
committermame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-08-25 13:41:11 +0000
commitcba52ec37cbe5be168f00ca9568e68fb1ed4f984 (patch)
treef3e96a875706ec16d27d2709727ac4b312a23e74 /lib/irb/extend-command.rb
parent4da80c7d6bca4de837637f03bd366a55999c36d7 (diff)
* 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
Diffstat (limited to 'lib/irb/extend-command.rb')
-rw-r--r--lib/irb/extend-command.rb9
1 files changed, 7 insertions, 2 deletions
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