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:

<snip>

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