diff options
author | Victor Shepelev <zverok.offline@gmail.com> | 2021-12-15 04:25:33 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-15 11:25:33 +0900 |
commit | 0fcc58a18c7c8896df1736fc644c1c9f84a6df0f (patch) | |
tree | 2b8d8f96802cde849312f22eb3c8570f07daad32 | |
parent | ac5d6faea8e8d142df798572b0522f8a185c8fb6 (diff) |
[DOC] Improve Thread::Queue.new docs [ci skip]
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/5273
Merged-By: nobu <nobu@ruby-lang.org>
-rw-r--r-- | thread_sync.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/thread_sync.c b/thread_sync.c index 33a0d5e9ca..eaf2c025b9 100644 --- a/thread_sync.c +++ b/thread_sync.c @@ -838,14 +838,26 @@ queue_closed_result(VALUE self, struct rb_queue *q) /* * Document-method: Queue::new * - * Creates a new queue instance, optionally using the contents of an Enumerable + * call-seq: + * Thread::Queue.new -> empty_queue + * Thread::Queue.new(enumerable) -> queue + * + * Creates a new queue instance, optionally using the contents of an +enumerable+ * for its initial state. * - * Example: + * Example: * * q = Thread::Queue.new - * q = Thread::Queue.new([a, b, c]) - * q = Thread::Queue.new(items) + * #=> #<Thread::Queue:0x00007ff7501110d0> + * q.empty? + * #=> true + * + * q = Thread::Queue.new([1, 2, 3]) + * #=> #<Thread::Queue:0x00007ff7500ec500> + * q.empty? + * #=> false + * q.pop + * #=> 1 */ static VALUE |