From 5fa9c2eeb04a2e44a2a028d933bc95f219a6a282 Mon Sep 17 00:00:00 2001 From: zverok Date: Sat, 21 Dec 2019 22:31:30 +0200 Subject: Actualize Method#inspect docs --- proc.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'proc.c') diff --git a/proc.c b/proc.c index 2e5654a687..73d9464ca0 100644 --- a/proc.c +++ b/proc.c @@ -2766,11 +2766,30 @@ rb_method_parameters(VALUE method) * * Returns a human-readable description of the underlying method. * - * "cat".method(:count).inspect #=> "#" - * (1..3).method(:map).inspect #=> "#" + * "cat".method(:count).inspect #=> "#" + * (1..3).method(:map).inspect #=> "#" * * In the latter case, the method description includes the "owner" of the * original method (+Enumerable+ module, which is included into +Range+). + * + * +inspect+ also provides, when possible, method argument names (call + * sequence) and source location. + * + * require 'net/http' + * Net::HTTP.method(:get).inspect + * #=> "#/lib/ruby/2.7.0/net/http.rb:457>" + * + * ... in argument definition means argument is optional (has + * some default value). + * + * For methods defined in C (language core and extensions), location and + * argument names can't be extracted, and only generic information is provided + * in form of * (any number of arguments) or _ (some + * positional argument). + * + * "cat".method(:count).inspect #=> "#" + * "cat".method(:+).inspect #=> "#"" + */ static VALUE -- cgit v1.2.3