From 0fcc58a18c7c8896df1736fc644c1c9f84a6df0f Mon Sep 17 00:00:00 2001 From: Victor Shepelev Date: Wed, 15 Dec 2021 04:25:33 +0200 Subject: [DOC] Improve Thread::Queue.new docs [ci skip] --- thread_sync.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'thread_sync.c') 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) + * #=> # + * q.empty? + * #=> true + * + * q = Thread::Queue.new([1, 2, 3]) + * #=> # + * q.empty? + * #=> false + * q.pop + * #=> 1 */ static VALUE -- cgit v1.2.3