[ruby-core:102050] [Ruby master Feature#17327] The Queue constructor should take an initial set of items
From:
matz@...
Date:
2021-01-13 06:05:42 UTC
List:
ruby-core #102050
Issue #17327 has been updated by matz (Yukihiro Matsumoto). I accept the idea. Take `Enumerable` as initial values. Matz. ---------------------------------------- Feature #17327: The Queue constructor should take an initial set of items https://bugs.ruby-lang.org/issues/17327#change-89906 * Author: chrisseaton (Chris Seaton) * Status: Open * Priority: Normal ---------------------------------------- I often create a `Queue` and then process it with a set of concurrent workers in threads. I end up writing: ```ruby q = Queue.new worklist.each do |work| q.push work end ``` I'd rather be able to write ```ruby q = Queue.new(*worklist) ``` -- https://bugs.ruby-lang.org/ Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>