diff options
author | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-02-18 18:02:02 +0000 |
---|---|---|
committer | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-02-18 18:02:02 +0000 |
commit | f98759935c5b0b33f5ba09115e7ff1fdf52bce4b (patch) | |
tree | 90beb282ac13d0e05f3f48f51006e03a7e3ef929 /README.EXT | |
parent | 75ba47e8e87e7dd2c92f1dee2cac834b505429f4 (diff) | |
download | ruby-f98759935c5b0b33f5ba09115e7ff1fdf52bce4b.tar.gz |
* README.EXT, README.EXT.ja: Improve the document about
rb_scan_args().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22421 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'README.EXT')
-rw-r--r-- | README.EXT | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/README.EXT b/README.EXT index 6364ab7a80..f1504021ba 100644 --- a/README.EXT +++ b/README.EXT @@ -690,18 +690,27 @@ pre-arg-spec := num-of-leading-mandatory-args [num-of-optional-args] post-arg-spec := sym-for-variable-length-args [num-of-trailing-mandatory-args] block-arg-spec := sym-for-block-arg -num-of-leading-mandatory-args := DIGIT ; -- the number of the leading mandatory arguments -num-of-optional-args := DIGIT ; -- the number of the following optional arguments -sym-for-variable-length-args := "*" ; -- indicates that the following variable length - ; arguments are captured as a Ruby array -num-of-trailing-mandatory-args := DIGIT ; -- the number of the trailing mandatory arguments -sym-for-block-arg := "&" ; -- indicates that the iterator block should be - ; captured if given +num-of-leading-mandatory-args := DIGIT ; The number of leading + ; mandatory arguments +num-of-optional-args := DIGIT ; The number of optional + ; arguments +sym-for-variable-length-args := "*" ; Indicates that variable + ; length arguments are + ; captured as a ruby array +num-of-trailing-mandatory-args := DIGIT ; The number of trailing + ; mandatory arguments +sym-for-block-arg := "&" ; Indicates that an iterator + ; block should be captured if + ; given -- For example, "11" means that the method requires at least one -argument, and at most receives two arguments. For omitted arguments, -variables are set to Qnil. +argument, and at most receives two (1+1) arguments. So, the format +string must be followed by two variable references, which are to be +set to captured arguments. For omitted arguments, variables are set +to Qnil. NULL can be put in place of a variable reference, which +means the corresponding captured argument(s) does not need to be set. + Methods with an arbitrary number of arguments can receive arguments by Ruby's array, like this: |