mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
Thread::Queue.new should accept an Enumerable [Feature #17327]
Enumerable implements #to_a but not #to_array.
This commit is contained in:
parent
e8b210542b
commit
1f0e0dfb22
3 changed files with 27 additions and 11 deletions
|
@ -858,7 +858,7 @@ rb_queue_initialize(int argc, VALUE *argv, VALUE self)
|
|||
list_head_init(queue_waitq(q));
|
||||
rb_scan_args(argc, argv, "01", &initial);
|
||||
if (argc == 1) {
|
||||
rb_ary_concat(q->que, rb_convert_type(initial, T_ARRAY, "Array", "to_ary"));
|
||||
rb_ary_concat(q->que, rb_to_array(initial));
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue