From: Paul Brannan Date: 2001-12-14T02:00:25+09:00 Subject: [ruby-talk:28423] Re: why is Proc's arity function so weird? On Fri, Dec 14, 2001 at 01:53:39AM +0900, Paul Brannan wrote: > Why does arity return -1 when there is 1 argument? The problem with > this is the following: Here's a workaround: class SafeProc < Proc attr_reader :arity def initialize(arity, &block) @arity = arity super(&block) end def call(*args, &block) if @arity >= 0 and args.length != arity then raise ArgumentError, "wrong # of arguments (#{args.length} for #{@arity})" end super(*args, &block) end end I do think I should not have to do this, though. Paul