1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

extension.rdoc: rb_check_arity [ci skip]

* doc/extension.rdoc (rb_check_arity): described.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56130 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2016-09-10 08:16:50 +00:00
parent d0c717e410
commit c5d707dc65

View file

@ -867,6 +867,9 @@ arguments. The third argument is a string that specifies how to
capture method arguments and assign them to the following VALUE capture method arguments and assign them to the following VALUE
references. references.
You can just check the argument number with rb_check_arity(), this is
handy in the case you want to treat the arguments as a list.
The following is an example of a method that takes arguments by Ruby's The following is an example of a method that takes arguments by Ruby's
array: array:
@ -1360,6 +1363,12 @@ rb_define_singleton_method(VALUE klass, const char *name, VALUE (*func)(), int a
Defines a singleton method. Arguments are same as rb_define_method(). Defines a singleton method. Arguments are same as rb_define_method().
rb_check_arity(int argc, int min, int max) ::
Check the number of arguments, argc is in the range of min..max. If
max is UNLIMITED_ARGUMENTS, upper bound is not checked. If argc is
out of bounds, an ArgumentError will be raised.
rb_scan_args(int argc, VALUE *argv, const char *fmt, ...) :: rb_scan_args(int argc, VALUE *argv, const char *fmt, ...) ::
Retrieve argument from argc and argv to given VALUE references Retrieve argument from argc and argv to given VALUE references