End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
class method
Array.try_convert
Array.try_convert(object) → object, new_array, or nil
array.c
View on GitHub ↗
static VALUE
rb_ary_s_try_convert(VALUE dummy, VALUE ary)
{
return rb_check_array_type(ary);
}
If object is an Array object, returns object.
Otherwise if object responds to :to_ary, calls object.to_ary and returns the result.
Returns nil if object does not respond to :to_ary
Raises an exception unless object.to_ary returns an Array object.