Thread::Queue.new should accept an Enumerable [Feature #17327]

Enumerable implements #to_a but not #to_array.
This commit is contained in:
Nobuyoshi Nakada 2021-02-12 12:21:49 +09:00
parent e8b210542b
commit 1f0e0dfb22
No known key found for this signature in database
GPG key ID: 7CD2805BFA3770C6
3 changed files with 27 additions and 11 deletions

View file

@ -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;
}