ruby-changes:32020
From: ktsj <ko1@a...>
Date: Tue, 10 Dec 2013 00:47:43 +0900 (JST)
Subject: [ruby-changes:32020] ktsj:r44099 (trunk): * ext/thread/thread.c: [DOC] add call-seq alias for Queue#enq, #<<, etc.
ktsj 2013-12-10 00:47:35 +0900 (Tue, 10 Dec 2013) New Revision: 44099 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=44099 Log: * ext/thread/thread.c: [DOC] add call-seq alias for Queue#enq, #<<, etc. * ext/thread/thread.c (Init_thread): use rb_define_alias instead of rb_alias to document alias. Modified files: trunk/ChangeLog trunk/ext/thread/thread.c Index: ChangeLog =================================================================== --- ChangeLog (revision 44098) +++ ChangeLog (revision 44099) @@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Tue Dec 10 00:41:42 2013 Kazuki Tsujimoto <kazuki@c...> + + * ext/thread/thread.c: [DOC] add call-seq alias for Queue#enq, #<<, etc. + + * ext/thread/thread.c (Init_thread): use rb_define_alias instead of + rb_alias to document alias. + Mon Dec 9 20:00:00 2013 Charlie Somerville <charliesome@r...> * internal.h (RCLASS_SERIAL): Add RCLASS_SERIAL as a convenience Index: ext/thread/thread.c =================================================================== --- ext/thread/thread.c (revision 44098) +++ ext/thread/thread.c (revision 44099) @@ -216,7 +216,10 @@ queue_do_push(VALUE self, VALUE obj) https://github.com/ruby/ruby/blob/trunk/ext/thread/thread.c#L216 /* * Document-method: Queue#push - * call-seq: push(object) + * call-seq: + * push(object) + * enq(object) + * <<(object) * * Pushes the given +object+ to the queue. */ @@ -294,7 +297,10 @@ queue_pop_should_block(int argc, VALUE * https://github.com/ruby/ruby/blob/trunk/ext/thread/thread.c#L297 /* * Document-method: Queue#pop - * call-seq: pop(non_block=false) + * call-seq: + * pop(non_block=false) + * deq(non_block=false) + * shift(non_block=false) * * Retrieves data from the queue. * @@ -338,6 +344,9 @@ rb_queue_clear(VALUE self) https://github.com/ruby/ruby/blob/trunk/ext/thread/thread.c#L344 /* * Document-method: Queue#length + * call-seq: + * length + * size * * Returns the length of the queue. */ @@ -436,7 +445,10 @@ rb_szqueue_max_set(VALUE self, VALUE vma https://github.com/ruby/ruby/blob/trunk/ext/thread/thread.c#L445 /* * Document-method: SizedQueue#push - * call-seq: push(object) + * call-seq: + * push(object) + * enq(object) + * <<(object) * * Pushes +object+ to the queue. * @@ -471,7 +483,10 @@ szqueue_do_pop(VALUE self, VALUE should_ https://github.com/ruby/ruby/blob/trunk/ext/thread/thread.c#L483 /* * Document-method: SizedQueue#pop - * call-seq: pop(non_block=false) + * call-seq: + * pop(non_block=false) + * deq(non_block=false) + * shift(non_block=false) * * Retrieves data from the queue. * @@ -555,11 +570,16 @@ Init_thread(void) https://github.com/ruby/ruby/blob/trunk/ext/thread/thread.c#L570 rb_define_method(rb_cQueue, "length", rb_queue_length, 0); rb_define_method(rb_cQueue, "num_waiting", rb_queue_num_waiting, 0); - rb_alias(rb_cQueue, rb_intern("enq"), rb_intern("push")); - rb_alias(rb_cQueue, rb_intern("<<"), rb_intern("push")); - rb_alias(rb_cQueue, rb_intern("deq"), rb_intern("pop")); - rb_alias(rb_cQueue, rb_intern("shift"), rb_intern("pop")); - rb_alias(rb_cQueue, rb_intern("size"), rb_intern("length")); + /* Alias for #push. */ + rb_define_alias(rb_cQueue, "enq", "push"); + /* Alias for #push. */ + rb_define_alias(rb_cQueue, "<<", "push"); + /* Alias for #pop. */ + rb_define_alias(rb_cQueue, "deq", "pop"); + /* Alias for #pop. */ + rb_define_alias(rb_cQueue, "shift", "pop"); + /* Alias for #length. */ + rb_define_alias(rb_cQueue, "size", "length"); rb_define_method(rb_cSizedQueue, "initialize", rb_szqueue_initialize, 1); rb_define_method(rb_cSizedQueue, "max", rb_szqueue_max_get, 0); @@ -567,10 +587,15 @@ Init_thread(void) https://github.com/ruby/ruby/blob/trunk/ext/thread/thread.c#L587 rb_define_method(rb_cSizedQueue, "push", rb_szqueue_push, 1); rb_define_method(rb_cSizedQueue, "pop", rb_szqueue_pop, -1); rb_define_method(rb_cSizedQueue, "num_waiting", rb_szqueue_num_waiting, 0); - rb_alias(rb_cSizedQueue, rb_intern("enq"), rb_intern("push")); - rb_alias(rb_cSizedQueue, rb_intern("<<"), rb_intern("push")); - rb_alias(rb_cSizedQueue, rb_intern("deq"), rb_intern("pop")); - rb_alias(rb_cSizedQueue, rb_intern("shift"), rb_intern("pop")); + + /* Alias for #push. */ + rb_define_alias(rb_cSizedQueue, "enq", "push"); + /* Alias for #push. */ + rb_define_alias(rb_cSizedQueue, "<<", "push"); + /* Alias for #pop. */ + rb_define_alias(rb_cSizedQueue, "deq", "pop"); + /* Alias for #pop. */ + rb_define_alias(rb_cSizedQueue, "shift", "pop"); rb_provide("thread.rb"); ALIAS_GLOBAL_CONST(ConditionVariable); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/