I'm wondering if Ruby's irb has the ability to supply method/function signatures or descriptions.
I know I can do something like this in the irb
[].methods.sort
and get all the methods/functions available to arrays but how can I get more information(while in the irb) about specific methods/functions?
You can use #method and then use Method methods:
1.method(:+).arity
# => 1
1.method(:+).parameters
# => [[:req]]
[].method(:reduce).parameters
# => [[:rest]]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With