Project

General

Profile

Backport #3938 ยป methodarity.rb

ruby script to minimally reproduce the incorrect behavior - Ethan (Ethan -), 10/13/2010 03:19 AM

 
def Object.onearg(arg)
arg
end
amethod = Object.method(:onearg)
aproc = proc{|arg| arg}

require 'pp'
pp([[1, 2]].detect(&aproc)) # works because proc works correctly
pp([[1]].detect(&amethod)) # works because arity happens to be the same as [1].size
pp([[1, 2]].detect(&amethod)) # doesn't work because arity isn't the asme as [1, 2].size
    (1-1/1)