asynchronize
asynchronize copied to clipboard
When called with too few arguments, an asynchronized method returns a thread before giving an invalid argument error
Description
When a method has been asynchronized, it will spawn and return a thread even if it has an invalid number of arguments. This is caused because the newly defined method accepts parameters through a splat operator. This is a minor issue, causing only a slight performance penalty when calling a method with the wrong number of arguments. The parameter information can be pulled, we should see if there's a way to use the actual information in the new method definition https://ruby-doc.org/core-2.2.0/Method.html#method-i-parameters.
Reproduction Steps
require 'asynchronize'
class Test
include Asynchronize
asynchronize :test
def test(a, b)
return a+b
end
end
th = Test.new.test(1)
th.class
=> Thread