mrb_ary_splat() to call #to_a

parent dc27c2be
...@@ -849,6 +849,9 @@ mrb_ary_splat(mrb_state *mrb, mrb_value v) ...@@ -849,6 +849,9 @@ mrb_ary_splat(mrb_state *mrb, mrb_value v)
if (mrb_array_p(v)) { if (mrb_array_p(v)) {
return v; return v;
} }
if (mrb_respond_to(mrb, v, mrb_intern_lit(mrb, "to_a"))) {
return mrb_funcall(mrb, v, "to_a", 0);
}
else { else {
return mrb_ary_new_from_values(mrb, 1, &v); return mrb_ary_new_from_values(mrb, 1, &v);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment