Issue #8088 has been reported by headius (Charles Nutter).

----------------------------------------
Feature #8088: Method#parameters (and friends) should provide useful information about core methods
https://bugs.ruby-lang.org/issues/8088

Author: headius (Charles Nutter)
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: 


I was wiring up #parameters to work for native methods today when I realized MRI doesn't give very good information about variable-arity native methods:

ext-jruby-local ~/projects/jruby $ ruby2.0.0 -e "p ''.method(:gsub).to_proc.parameters"
[[:rest]]

ext-jruby-local ~/projects/jruby $ jruby -e "p ''.method(:gsub).to_proc.parameters"
[[:req], [:opt]]

I think MRI should present the same as JRuby here; gsub is obviously not a rest-arg method and you can't call it with less than 1 or more than 2 arguments. JRuby's presenting the right output here.

I'm probably going to have to change JRuby to do the less-helpful version so we're compliant and tests pass, but I think the specification of #parameters should be that it presents the JRuby version about rather than the MRI version.


-- 
http://bugs.ruby-lang.org/