diff options
author | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-09-10 07:51:58 +0000 |
---|---|---|
committer | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-09-10 07:51:58 +0000 |
commit | 82abe79b9fa3b5a648f453076a28ed9566d02ec8 (patch) | |
tree | 38c67940337c200adc83b83669049492fb4a3534 /README.EXT | |
parent | 4f77c495cddcdfcbb15e363ba21d09e5a9ddfd37 (diff) | |
download | ruby-82abe79b9fa3b5a648f453076a28ed9566d02ec8.tar.gz |
* class.c (rb_scan_args): Add support for optional keyword
argument hash.
* README.EXT, README.EXT.ja: Update documentation accordingly.
* dir.c (dir_initialize): Make use of the new rb_scan_args()
feature.
* io.c (rb_io_s_popen, rb_scan_open_args, rb_io_initialize)
(rb_io_s_pipe, open_key_args, io_s_foreach, io_s_readlines)
(rb_io_s_read, rb_io_set_encoding): Ditto.
* transcode.c (str_transcode, econv_args)
(econv_primitive_convert): Ditto.
* ext/zlib/zlib.c (rb_gzreader_initialize): Ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29214 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'README.EXT')
-rw-r--r-- | README.EXT | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/README.EXT b/README.EXT index ac0d7cc98d..c2b2d9d52d 100644 --- a/README.EXT +++ b/README.EXT @@ -1105,12 +1105,13 @@ according to the format string. The format can be described in ABNF as follows: -- -scan-arg-spec := param-arg-spec [block-arg-spec] +scan-arg-spec := param-arg-spec [option-hash-arg-spec] [block-arg-spec] param-arg-spec := pre-arg-spec [post-arg-spec] / post-arg-spec / pre-opt-post-arg-spec 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] pre-opt-post-arg-spec := num-of-leading-mandatory-args num-of-optional-args num-of-trailing-mandatory-args +option-hash-arg-spec := sym-for-option-hash-arg block-arg-spec := sym-for-block-arg num-of-leading-mandatory-args := DIGIT ; The number of leading @@ -1122,6 +1123,18 @@ sym-for-variable-length-args := "*" ; Indicates that variable ; captured as a ruby array num-of-trailing-mandatory-args := DIGIT ; The number of trailing ; mandatory arguments +sym-for-option-hash-arg := ":" ; Indicates that an option + ; hash is captured if the last + ; argument is a hash or can be + ; converted to a hash with + ; #to_hash. When the last + ; argument is nil, it is + ; captured if it is not + ; ambiguous to take it as + ; empty option hash; i.e. '*' + ; is not specified and + ; arguments are given more + ; than sufficient. sym-for-block-arg := "&" ; Indicates that an iterator ; block should be captured if ; given @@ -1134,8 +1147,8 @@ assigned 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) should be just dropped. -The number of given arguments, excluding an iterator block, is -returned. +The number of given arguments, excluding an option hash or iterator +block, is returned. ** Invoking Ruby method |