ruby-changes:31235
From: zzak <ko1@a...>
Date: Thu, 17 Oct 2013 05:54:28 +0900 (JST)
Subject: [ruby-changes:31235] zzak:r43314 (trunk): * ext/io/nonblock/nonblock.c: [DOC] Document io/nonblock by reprah
zzak 2013-10-17 05:54:23 +0900 (Thu, 17 Oct 2013) New Revision: 43314 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=43314 Log: * ext/io/nonblock/nonblock.c: [DOC] Document io/nonblock by reprah [Fixes GH-418] https://github.com/ruby/ruby/pull/418 based on the original discussion from documenting-ruby/ruby#18 Modified files: trunk/ChangeLog trunk/ext/io/nonblock/nonblock.c Index: ChangeLog =================================================================== --- ChangeLog (revision 43313) +++ ChangeLog (revision 43314) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Thu Oct 17 05:52:31 2013 Zachary Scott <e@z...> + + * ext/io/nonblock/nonblock.c: [DOC] Document io/nonblock by reprah + [Fixes GH-418] https://github.com/ruby/ruby/pull/418 based on the + original discussion from documenting-ruby/ruby#18 + Thu Oct 17 05:40:33 2013 Koichi Sasada <ko1@a...> * gc.c (objspace_each_objects): do not skip empty RVALUEs. Index: ext/io/nonblock/nonblock.c =================================================================== --- ext/io/nonblock/nonblock.c (revision 43313) +++ ext/io/nonblock/nonblock.c (revision 43314) @@ -30,6 +30,12 @@ io_nonblock_mode(int fd) https://github.com/ruby/ruby/blob/trunk/ext/io/nonblock/nonblock.c#L30 #endif #ifdef F_GETFL +/* + * call-seq: + * io.nonblock? -> boolean + * + * Returns +true+ if an IO object is in non-blocking mode. + */ static VALUE rb_io_nonblock_p(VALUE io) { @@ -61,6 +67,13 @@ io_nonblock_set(int fd, int f, int nb) https://github.com/ruby/ruby/blob/trunk/ext/io/nonblock/nonblock.c#L67 rb_sys_fail(0); } +/* + * call-seq: + * io.nonblock = boolean -> boolean + * + * Enables non-blocking mode on a stream when set to + * +true+, and blocking mode when set to +false+. + */ static VALUE rb_io_nonblock_set(VALUE io, VALUE nb) { @@ -79,6 +92,16 @@ io_nonblock_restore(VALUE arg) https://github.com/ruby/ruby/blob/trunk/ext/io/nonblock/nonblock.c#L92 return Qnil; } +/* + * call-seq: + * io.nonblock {|io| } -> io + * io.nonblock(boolean) {|io| } -> io + * + * Yields +self+ in non-blocking mode. + * + * When +false+ is given as an argument, +self+ is yielded in blocking mode. + * The original mode is restored after the block is executed. + */ static VALUE rb_io_nonblock_block(int argc, VALUE *argv, VALUE io) { -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/