aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-09-10 08:16:50 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-09-10 08:16:50 +0000
commit9da4dfb62a17b200eaaff458aec3edcba5255f9c (patch)
tree5c6bcf2aef6b44032416b40dd50383fd4281f7f3
parent3bb183188d5ee8adee9ac36f7983853dc2f1a836 (diff)
downloadruby-9da4dfb62a17b200eaaff458aec3edcba5255f9c.tar.gz
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
-rw-r--r--doc/extension.rdoc9
1 files changed, 9 insertions, 0 deletions
diff --git a/doc/extension.rdoc b/doc/extension.rdoc
index 28052708e2..7eb173debe 100644
--- a/doc/extension.rdoc
+++ b/doc/extension.rdoc
@@ -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
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
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().
+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, ...) ::
Retrieve argument from argc and argv to given VALUE references